I have found examples of a Regex that will match if a string does not contain a particular word. But I am looking for something that will match if it contains a word AND not another word. Example:
I'm dealing with URL exclusions based off of RegEx. I would like it to match if the URL contains collections and not products
The Regex I have found to work if it does not contain products is this: ^((?!products).)*$ Works great but any time I add in a check to make sure it has collections in it, it fails every time.
Here is a sample url I would like it not to match:
https://dummysite.com/collections/frontpage/products/myproduct
But if it were:
https://dummysite.com/collections/frontpage/
It should match.
How do I solve this problem?