如果整个页中只有一个<h2></h2>的话,用正则<h2>([\s\S]*?)</h2>
然后groups取1
[C#] 纯文本查看 复制代码 string Html = "<div class=\"focusImg\"><a href=\"http://dajia.qq.com/blog/430281004345066\" target=\"_blank\" boss=\"{id:1220, sBiz:'dajia_web', name:'right_focus', sBak1:'home', sBak2:'_no_login_'}\"><img src=\"http://img1.gtimg.com/cul/pics/hv1/161/174/1698/110456981.jpg\" /><h2>日本历史观中的慰安妇问题</h2><h3>作者:张石</h3></a></div><div class=\"teamList tj\">";
Regex re = new Regex(@"<h2>([\s\S]*?)</h2>");
MatchCollection mc = re.Matches(Html);
foreach (Match m in mc)
{
MessageBox.Show(m.Groups[1].Value);
} |