Consider this blob of text:
@"
I want to match the word 'highlight' in a string. But I don't want to match
highlight when it is contained in an HTML anchor element. The expression
should not match highlight in the following text: <a href='#'>highlight</a>
"
Here's what the output should look like (matches are in bold):
I want to match the word "highlight" in a string. But I don't want to match highlight when it is contained in an HTML anchor element. The expression should not match highlight in the following text: highlight
How would you construct an expression that matches all occurrences of X, excluding matches inside HTML anchor elements?