I want to match occurrences of a term that do not appear within xhtml tags. So in the following example I want to only match the second occurrence for font:
<font color="red">font might be red</font>
Of course, I need to be flexible and "font" might be substituted for anything. I just want matches that are not within a xhtml tag <....>
I tried this:
rex = new Regex("(?:?<=<)(?:?!>)\\b" + strHighlight + "\\b(?:?!=>)(?:?=<)", RegexOptions.IgnoreCase);
But that does not seem to work. Probably because it not the right way to say that strHighlight should not be within a <....> tag...
Thanks for your help!