How to negate specific word in regex?
regex
Solution
A great way to do this is to use negative lookahead:
^(?!.*bar).*$
The negative lookahead construct is the pair of parentheses, with the opening parenthesis followed by a question mark and an exclamation point. Inside the lookahead [is any regex pattern].
Problem
I know that I can negate group of chars as in `[^bar]` but I need a regular expression where negation applies to the specific word - so in my example how do I negate an actual `bar`, and not "any chars in bar"?