我正在.NET
项目中使用正则表达式来获取特定标记。 我想匹配整个DIV标签及其内容:
<html>
<head><title>Test</title></head>
<body>
<p>The first paragraph.</p>
<div id='super_special'>
<p>The Store paragraph</p>
</div>
</body>
</head>
码:
Regex re = new Regex("(<div id='super_special'>.*?</div>)", RegexOptions.Multiline);
if (re.IsMatch(test))
Console.WriteLine("it matches");
else
Console.WriteLine("no match");
我想要匹配这个:
<div id="super_special">
<p>Anything could go in here...doesn't matter. Let's get it all</p>
</div>
我想.
应该得到所有的角色,但它似乎有回车的麻烦。 我的正则表达式遗失了什么?
谢谢。