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.
(?=foo)
(?!foo)
(?<=foo)
(?<!foo)
You can do multiple assertions:
^(?!abc:)(?!defg:)
or:
^(?!defg:)(?!abc:)
...and the order does not make a difference.
1.4m articles
1.4m replys
5 comments
57.0k users