HomeLookahead/Lookbehind
Lookahead/Lookbehind
Zero-width assertions and advanced logic.
9 Tools Available
Positive Lookahead
Matches q followed by u.
/q(?=u)/
Negative Lookahead
Matches q NOT followed by u.
/q(?!u)/
Positive Lookbehind
Matches b preceded by a.
/(?<=a)b/
Negative Lookbehind
Matches b NOT preceded by a.
/(?<!a)b/
Password Rule
Lookahead for digit.
/(?=.*\d)/
Exclude Word
Match word if not "bad".
/\b(?!bad)\w+\b/
Preceded by $
Match numbers after $.
/(?<=\$)\d+/
Followed by Unit
Match number before kg.
/\d+(?=kg)/
Not preceded by digit
Match text not after numbers.
/(?<!\d)[a-z]+/