How would I construct a regex that would match if either "foo" and "bar" (or any combination thereof) where present but NOTHING ELSE was?
So for example:
"foo bar ipsum dolor sit amet, consectetur adipiscing elit" - NO MATCH
"ipsum dolor sit amet, consectetur adipiscing elit foo" - NO MATCH
"foo ipsum dolor sit amet, bar consectetur adipiscing elit foo" - NO MATCH
"foo" - MATCH
"bar" - MATCH
"barfoo" - MATCH
"foobarbarfoofoobar" - MATCH
I'm trying to grok negative lookaheads but I haven't been able to crack this yet.
foofoofooa valid match? - anubhava