A: 

Use the HTML Agility Pack, see my answer here, http://stackoverflow.com/questions/1569917/how-do-i-parse-html-using-regular-expressions-in-c/1569970#1569970

nickyt
Does HTML Agility support sections surrounded with special comments as per this question? I'm already trying to use agility for this but can't how to select anything other than normal nodes.
Dan Revell
+1  A: 

You don't want to put parentheses around .*.

This means to grab everything greedily, or not.

(.*)?

This means to grab everything lazily:

.*?

Also, in your regex, you have only one - in the ending token. Change it to this:

<!-- InstanceBeginEditable.*?-->(?<content>.*?)<!-- InstanceEnd

By the way, it's dangerous to have two .*s in a regex without an atomic group. On unexpected data, you can get catastrophic backtracking. I'd recommend changing the first .*? to [^-]*. And, while I'm at it, I'll suggest you handle whitespace more forgivingly:

<!--\s*InstanceBeginEditable[^-]*-->(?<content>.*?)<!--\s*InstanceEnd

You probably already know this, but let me add that with .NET, you'll need to use RegexOptions.Singleline.

Jeremy Stein
Hi Jeremy, the single - in the end token was curtesy of Word, but thanks for noticing!
Greg B
Thanks for the info on greadyness/lazyness. I had thought of using \s for white space but while I was trying to get it working I thought I'd keep it simple with a literal SPACE. Cheers
Greg B