I have the following regex which I use to find a word:
(?<=\s)([\w\@\-]+)(?=\s)
I want to further modify this regex to exclude a list of words e.g. do not match if the word is 'cat' or 'dog'.
How do I accomodate the regex to achieve this?
I have the following regex which I use to find a word:
(?<=\s)([\w\@\-]+)(?=\s)
I want to further modify this regex to exclude a list of words e.g. do not match if the word is 'cat' or 'dog'.
How do I accomodate the regex to achieve this?
\b(?!(?:dog|cat)\b)([\w@-]+)\b
Here if you want to match word start/end with @
(?<=\s)(?!(?:dog|cat)(?=\s))([\w\@\-]+)(?=\s)