正则获得所有括号内的信息

   Regex regex = new Regex(@"(?<=\()[^()]+(?=\))");
string forContent=@"(
(DS_NE_CELL_G.BTS_NAME)-(DS_PRD_A_CELL_H.FREECOUNT)
)
/
(
(DS_NE_CELL_G.BTS_NAME)+(DS_PRD_A_CELL_H.FREECOUNT)
) >2
";
MatchCollection mm = regex.Matches(forContent);
int k = 1;
foreach (Match m in mm)
{
k++;
forContent = forContent.Replace(m.Value, k.ToString());
}
posted @ 2011-11-28 15:45  luosm  阅读(453)  评论(0编辑  收藏  举报