System.Collections.Generic.List<System.Collections.Generic.List<string>> sum = new System.Collections.Generic.List<System.Collections.Generic.List<string>>();
string str = "<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table>";
var s1 = System.Text.RegularExpressions.Regex.Matches(str, @"<tr>(.+?)</tr>");
foreach (System.Text.RegularExpressions.Match m1 in s1)
{
var s2 = System.Text.RegularExpressions.Regex.Matches(m1.Groups[1].Value, @"<td>(.+?)</td>");
var lst = new System.Collections.Generic.List<string>();
foreach (System.Text.RegularExpressions.Match m2 in s2)
{
lst.Add(m2.Groups[1].Value);
}
sum.Add(lst);
}
追问哥们儿,非常感谢!关于正则这块,本人白痴。能不能再修改下,某些之间还夹杂着标签的,如果遇到有的就取里面的内容