中国开发网: 论坛: 程序员情感CBD: 贴子 809338
JoJo
是我想错了,这个必须得用迭代才行
string patten = "\\<table\\>(.*)\\</table\\>";
Regex re = new Regex(patten, RegexOptions.IgnoreCase & RegexOptions.Multiline & RegexOptions.CultureInvariant);
string test = "<table><tr><td><table><tr><td>Hello</td></tr></table></td></tr></table>";
Match m = re.Match(test);
Console.WriteLine("Input: {0}", test);
while (m.Groups.Count == 2)
{
if (re.IsMatch(m.Groups[1].Value))
{
m = re.Match(m.Groups[1].Value);
}
else
{
break;
}
}
Console.WriteLine("Last Find: {0}", m.Value);

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录