<div align='center' style='cursor:hand' onclick=' openContent(262962);'>123</div>
<div align='center' style='cursor:hand' onclick=' openContent(262963);'>124</div>怎样利用正则获取以下数据
262962
262963先谢过啦
<div align='center' style='cursor:hand' onclick=' openContent(262963);'>124</div>怎样利用正则获取以下数据
262962
262963先谢过啦
(?<=<div[\s|\S]*?(?:openContent\())[^\)]*
<div align='center' style='cursor:hand' onclick=' openContent(262963);'>124 </div> ";
Regex reg = new Regex(@"(?is)openContent\((.*?)\)"); MatchCollection mc = reg.Matches(str);
foreach (Match m in mc)
{
Console.WriteLine(m.Groups[1].ToString());
}
/*
------输出结果------------
262962
262963
*/