例:
<p><table><tr>.....<tr></table></p>
<p><img src="1.jpg"></p>
<p><table><tr>.....<tr></table></p>我只想要<table>里的内容包括<table>,把这两组<table>放到string数组里面
<p><table><tr>.....<tr></table></p>
<p><img src="1.jpg"></p>
<p><table><tr>.....<tr></table></p>我只想要<table>里的内容包括<table>,把这两组<table>放到string数组里面
是获取table中所有<td>的值
Regex reg = new Regex(@"(?is)<table>.+?</table>");
foreach (Match m in reg.Matches(str))
{
Response.Write(Server.HtmlEncode(m.Value));
}
foreach (Match m in reg.Matches(s))
{
MessageBox.Show(m.Value);
}
string allM="";
foreach (Match m in reg.Matches(s))
{
allM+=m.value+"|";
}
MessageBox.Show(allM);
试试