Is it possible to do string negation in regular expressions? I need to match all strings that do not contain the string \"..\". I know you can use ^[^\\
\"..\"
^[^\\
You can use negative lookaheads:
^(?!.*\.\.).*$
That causes the expression to not match if it can find a sequence of two periods anywhere in the string.
^(?:(?!\.\.).)*$
will only match if there are no two consecutive dots anywhere in the string.