How do I use regex to match any word (\w) except a list of certain words? For example:
I want to match the words
use this <-- match
utilize that <-- match
use something <-- don't want to match this
utilize fish <-- don't want to match this
You can use a negative lookahead to determine that the word you are about to match is not a particular thing. You can use the following regex to do this:
This will match "use" or "utilize" followed by a space, and then if the following word is not "fish" or "something", it will match that next word.