62,244
社区成员




string str = "<table id=\"tableFee\" class=\"resulttable\"><thead><tr><th>合同号</th></tr></thead><tbody>\r\n<tr onmouseover=\"mover(this,true)\" onmouseout= \"mout(this,true)\">\r\n<td rowspan=\"2\"><a herf='OrderDetail.aspx?Id=1273'>N100023 </a></td>\r\n</tr>\r\n</tbody>\r\n</table>";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"(?is)(?<content>(</?(?!(table|tr|td|thead|th|tbody))\w+\s{0,}[^>]*?>)|((?<=<\w+\s){1,}[^>]*?)(?=>))", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.MatchCollection m = reg.Matches(str); //设定要查找的字符串
for (int i = 0; i < m.Count; i++)
{
Response.Write(m[i].Groups["content"].ToString()+"<br>");
}
string str = "<table skdjflksdj dkf><tr a><a a>asdfsdf dsfsd cdc</a></td>";
str = Regex.Replace(str, @"(?<=</?\w+) [^>]*", "");
str = Regex.Replace(str, @"<(?!/?(table|tr|td|thead|tbody|th)).*?>", "");
Response.Write(str);
string str = "<table id=\"tableFee\" class=\"resulttable\"><thead><tr><th>合同号</th></tr></thead><tbody>\r\n<tr onmouseover=\"mover(this,true)\" onmouseout= \"mout(this,true)\">\r\n<td rowspan=\"2\"><a herf='OrderDetail.aspx?Id=1273'>N100023 </a></td>\r\n</tr>\r\n</tbody>\r\n</table>";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"(?is)<\w+\s{1,}(?<content>[^<>]*)>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.MatchCollection m = reg.Matches(str); //设定要查找的字符串
for (int i = 0; i < m.Count; i++)
{
Response.Write(m[i].Groups["content"].ToString()+"<br>");
}