Greetings!
I'm working on a regular expression in a .NET project to get a specific tag. I would like to match the entire DIV tag and its contents:
<html>
<head><title>Test</title></head>
<body>
<p>The first paragraph.</p>
<div id='super_special'>
<p>The Store paragraph</p>
</div>
</body>
</head>
Code:
Regex re = new Regex("(<div id='super_special'>.*?</div>)", RegexOptions.Multiline);
if (re.IsMatch(test))
Console.WriteLine("it matches");
else
Console.WriteLine("no match");
I want to match this:
<div id="super_special">
<p>Anything could go in here...doesn't matter. Let's get it all</p>
</div>
I thought . was supposed to get all characters, but it seems to having trouble with the cariage returns. What is my regex missing?
Thanks.