Which regular expression can I use to find all strings bar
are not preceded by string foo
? Having whitespace between the two is also illegal.
So the regex should match the following strings
foo is bar
hello bar
But not these
foobar
foo bar
I've tried using the following
(?!<foo)bar
and it gets the work done for eliminating foobar
, but I need to take care of the whitespace, and of course
(?!<foo)\s*bar
matches all the strings.
Thanks!