How can I match strings without another string?
Example strings:
foo bar qux Expected Result: MATCH (`foo` & `bar` without `skip` or `ignore`)
foo Expected Result: NO MATCH (`foo`, without `bar`)
bar baz qux Expected Result: NO MATCH (`bar`, without `foo`)
foo bar skip Expected Result: NO MATCH (`foo` & `bar`, but also `skip`)
ignore foo bar Expected Result: NO MATCH (`foo` & `bar`, but also `ignore`)
baz qux Expected Result: NO MATCH (not `foo` & `bar`)
Regex:
/(?=.*?\bfoo\b)(?=.*?\bbar\b)((?!skip|ignore).)*$/gi
Here's a Regexr sandbox: https://regexr.com/4t4lo
Yes, there are several similar questions, but nothing I've been able to work into this simple sandbox.