I'm looking to match all text in the format foo:12345 that is not contained within an HTML anchor. For example, I'd like to match lines 1 and 3 from the following:
foo:123456
<a href="http://www.google.com">foo:123456</a>
foo:123456
I've tried these regexes with no success:
Negative lookahead attempt ( incorrectly matches, but doesn't include the last digit )
foo:(\d+)(?!</a>)
Negative lookahead with non-capturing grouping
(?:foo:(\d+))(?!</a>)
Negative lookbehind attempt ( wildcards don't seem to be supported )
(?<!<a[^>]>)foo:(\d+)