Regular Expression Opposite

Couldn’t you just check to see if there are no matches? I don’t know what language you are using, but how about this pseudocode?

if (!'Some String'.match(someRegularExpression))
    // do something...

If you can only change the regex, then the one you got from your link should work:

/^((?!REGULAR_EXPRESSION_HERE).)*$/

Leave a Comment