不会正则表达式,这个比较常用,留用
注意group[0].value中带着两头筛选条件,group[1].value中没有
string str12="<a href=\"标注1\" target=_blank>标注2</a>"; string pattern12 = "<a\\shref=\"([^\"]*)\"\\starget=_blank>(.*?)</a>"; var m = Regex.Match(str12,pattern12,RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); string bs1 = m.Groups[1].Value; string bs2 = m.Groups[2].Value; string str3 = "<a class=bl href=\"profile.PHP?action=show&uid=85521\">标注3</a>"; string pattern3 = "<a\\sclass=bl[^<]*>(.*?)</a>"; m = Regex.Match(str3,pattern3,RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); string bs3 = m.Groups[1].Value; string str4 = "<div class=f10>标注4</div>"; string pattern4 = "<div\\sclass=f10[^<]*>(.*?)</div>"; m = Regex.Match(str4,pattern4,RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); string bs4 = m.Groups[1].Value;