I am looking to scan through some HTML and look for specific text (lets say "foo") but if it is in a comment I don't want to include it
So say I had some html like this:
<div id="foo"> Some foo here
<!-- this is a foo comment
-->
And finally some more foo
It would find all the foo's EXCEPT the foo comment
I've played with negative lookaheads but for the life of me cannot get it to work...
Any regex guru's out there?
I know some folks will suggest using a HTML parser but I want to stay away from that...
Thanks in advance...