Okay, so I'm working with html and I want to match everything between two comments generated by a CMS - including linebreaks.
Example:
<!-- Start Magic -->
<h2>My title</h2>
<p>Here's some content</p>
<p>And hey look, a linebreak!
And here's another for good measure!
</p>
<!-- End Magic -->
And here's the Regex I'm using to extract the guts:
Regex.Match(magic, @"<!-- Start Magic -->(?<guts>[\s\S]*?)<!-- End Magic -->");
Now I should note that this actually works fine. I just wondered whether using [\s\S]*?
is the best way of matching everything (including line breaks) in a non-greedy fashion.