I currently have a regular expression to match where a string contains 'bar' but is not preceded by 'foo':
I wish to modify the regex to match where a string contains 'bar' but is not preceded by 'foo' and (optionally) any additional character(s).
EG. 'footestbar' should not match as bar is preceded by 'foo' followed by 'test'.
I cannot find a way to achieve this as regular expressions do not permit the use of a quantifier within a negative lookbehind. Subsequently I cannot do the following:
Is there an alternative approach?
The regular expression flavour is re2. I am currently reviewing the documentation, but on first glance have noticed the following:
(?<!re) after text not matching re (NOT SUPPORTED)
Therefore the solution cannot use a negative lookbehind (if I'm interpreting the documentation correctly).