Regular Expressions 101

Community Patterns

Negative lookahead with example

0

Regular Expression
PCRE (PHP <7.3)

/
^(?:(?!ab|cd)(.))+$
/
gm

Description

This text won't match because it does contain ab in it!

This text won't match because it does contain cd in it!

This text matches because it doesn't contain them in itghdfgdfg!

Submitted by jarea - 3 years ago