正则 提取html标签value

using System.Text.RegularExpressions;

//step2: extract expected info
//<h1 class="h1user">crifan</h1>
string h1userP = @"<h1s+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 !";
}
原文地址:https://www.cnblogs.com/HaifengCai/p/3637630.html