Similar questions have been asked, but none answer this specific question.
Given this representative text:
foo
bar
foo bar
bar foo
foo bar foo
bar foo bar
Is it possible to use regular expressions to match only lines that do contain the word foo
but don't contain the word bar
?
If this desired regular expression was run on the above text, it would only result in:
foo