日期:2014-05-19  浏览次数:20771 次

帮忙解释以下正则表达式(c#)
string   headerRegex   =   "(? <=ti8   fc_3333 '> )[^ <]{10,} ";

string   textRegex   =   "(? <=528   class= 'break '> )[^/]* </td> </tr> ";

MatchCollection   mcHeader;
               
MatchCollection   mcText;

------解决方案--------------------
哦,原来是要解释下

string headerRegex = "(? <=ti8 fc_3333 '> )[^ <]{10,} ";

(? <=ti8 fc_3333 '> ) 反向预搜索,在这一位置之前为ti8 fc_3333
[^ <]{10,} 不是“ <”的任意字符,至少10个以上


string textRegex = "(? <=528 class= 'break '> )[^/]* </td> </tr> ";

(? <=528 class= 'break '> )  反向预搜索,在这一位置之前为528 class= "break "
[^/]* 不是“/”的任意字符,0个或任意多个
</td> </tr>  普通文本字符

MatchCollection mcHeader;

MatchCollection mcText;

创建MatchCollection实例