I want to regex to find the word 'cat' which are not immediately (with perhaps whitespace) followed by the word 'dog', so that it should match 'we have catnip for sale' and 'my cat eats dogs' but not match 'I sell hot cat dogs'.
The regex I could come up with was: /cat *([^d]|[^ ][^o]|[^ ].[^g])/
But for a longer 'dog', this would be a pain. Looking for a better solution.
In reply to search for 'cat' not followed by 'dog' by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |