正则 提取html标签value

using System.Text.RegularExpressions;

//step2: extract expected info
//<h1 class="h1user">crifan</h1>
string h1userP = @"<h1\s+class=""h1user"">(?<h1user>.+?)</h1>";
Match foundH1user = (newRegex(h1userP)).Match(rtbExtractedHtml.Text);
if (foundH1user.Success)
{
    //extracted the expected h1user's value
    txbExtractedInfo.Text = foundH1user.Groups["h1user"].Value;
}
else
{
    txbExtractedInfo.Text = "Not found h1 user !";
}
posted @ 2014-04-01 09:53  TRHFC  阅读(390)  评论(0编辑  收藏  举报