I'm new to regular expressions and believe this is really easy to someone that is good at it =)
I'm searching a html document for a title that's inside <h1> tags.
it could look something like this:
text text text
text <h1>Here is the title I want
and it could span over multiple lines</h1>
I tried this simple RegEx: <h1>(.*)</h1>
But it doesn't work over multiple lines. And I'm also worried that it will match from the first <h1> tag in document to the last (if multiple) </h1>?
And, I only want the result to be: Here is the title I want and it could span over multiple lines
, not including the <h1> and </h1>
My code is:
var titleMatch = new Regex("<h1>(.*)</h1>", RegexOptions.IgnoreCase).Match(htmlInput);
Thanks for any help.