111,128
社区成员
发帖
与我相关
我的任务
分享
string rowData ="<a id=\"gridview1_ctl02_hyperlink1\" href=\"yushou_info.aspx?ysbh=2016-013\" style=\"display:inline-block;color: maroon\"><u>2016-013</u></a>";
rowData +=" </font></td><td bgcolor=\"white\">AAAAAAA</td><td bgcolor=\"white\">BBBBBBB</td><td bgcolor=\"white\">CCCCCC</td><td bgcolor=\"white\" width=\"10%\">2016-01-28</td></tr>";
string match= "(?s)[^>]*<a id=\"[^>]*\" href=\"[^>]*\"> style=\"[^>]*\"><u>(?<bah>.*?)</u></a>\r\n[^>]*</font></td>[^>]*<td bgcolor=\"white\">(?<lpmc>.*?)[^>]*</td>[^>]*<td bgcolor=\"white\">(?<lh>.*?)[^>]*</td>[^>]*<td bgcolor=\"white\">(?<jzmj>.*?)[^>]*</td>[^>]*<td bgcolor=\"white\" width=\"10%\">(?<ts>.*?)[^>]*</td>[^>]*</tr>"
GroupCollection matchValues = GetDomInnerHtml(rowData ,match);
public GroupCollection GetDomInnerHtml(string html, string match)
{
Regex reg = new Regex(match, RegexOptions.Multiline | RegexOptions.IgnoreCase);
Match mc = reg.Match(html);
if (mc.Success)
return mc.Groups;
else return null;
}