Do you want to
^mail\.(?!.*\.wow\.com$).*$
As others have argued, (?!) Is a negative statement with zero width; it does not correspond to the number of characters, but sees in the following characters and ensures that they do not match what is contained in parentheses.
Javascript has copied the regular expression syntax from Perl; they are commonly known as PCRE or Perl-compatible regular expressions; however, Javascript has only views, that is, they see from this point into the future; Perl also has a negative view with zero width, which will work as your original example, in which case itβs easier
# this is how it could be done in Perl ^mail\..*(?<!\.wow\.com)$
However, Javascript decided not to support lookbehinds.
source share