I'm trying to match a string (using a Perl regex) only if it doesn't start with "abc:" or "defg:", but I can't seem to find out how. I've tried something like
^(?:(?!abc:)|(?!defg:))
Lookahead (?=foo)
, (?!foo)
and lookbehind (?<=foo)
, (?<!foo)
do not consume any characters.
You can do multiple assertions:
^(?!abc:)(?!defg:)
or:
^(?!defg:)(?!abc:)
...and the order does not make a difference.