110,529
社区成员
发帖
与我相关
我的任务
分享
<div class="concenter">
<p><img src="/images/czcg.gif" alt="" />我是标题我是标题</p>
<p>我是内容我是内容我是内容,</p>
<p>感谢您的使用。</p>
<p><input class="btngray" style="width:90%;" name="" type="button" value="我市价的"
onclick="javascript:window.location.href='/1212/3232.jsp'" /></p>
</div>
string html = "<div class=\"concenter\"><p><img src=\"/images/czcg.gif\" alt=\"\" />我是标题</p><p>我是内容我是内容我是内容,</p><p>感谢您的使用。</p><p><input class=\"btngray\" style=\"width:90%;\" name=\"\" type=\"button\" value=\"查看充值缴费记录\" onclick=\"javascript:window.location.href='/2121/121.jsp'\" /></p></div>";
void Main()
{
string html = "<div class=\"concenter\"><p><img src=\"/images/czcg.gif\" alt=\"\" />我是标题</p><p>我是内容我是内容我是内容,</p><p>感谢您的使用。</p><p><input class=\"btngray\" style=\"width:90%;\" name=\"\" type=\"button\" value=\"查看充值缴费记录\" onclick=\"javascript:window.location.href='/2121/121.jsp'\" /></p></div>";
var reg=new Regex("(?is)<div class=\"concenter\">.*?<p><img .*?>(?<title>.*?)</p>.*?<p>(?<content>.*?)</p>");
Match m =reg.Match(html);
Console.WriteLine(m.Groups["title"].Value);
Console.WriteLine(m.Groups["content"].Value);
}
(?is)<div class="concenter">.*?<p><img .*?>(?<title>.*?)</p>.*?<p>(?<content>.*?)</p>