Cheatsheet Pages / Regex Cheatsheet
Lookahead in regex: require (or forbid) what follows — (?=...) and (?!...)
A match only counts if the next characters are — or are not — a specific thing, without consuming them.
Patterns use the syntax shared by PCRE / Python / JavaScript; engine differences are flagged in the cheatsheet where they matter. Test any pattern at regex101.com — and pick the matching engine.
\d+(?= dollars)
# matches "100" in "100 dollars" — " dollars" stays for later
^(?=.*[A-Z])(?=.*\d).{8,}$
# password: 8+ chars, at least one uppercase and one digit
foo(?!bar)
# "foo" not followed by "bar" — matches "food", "fool", not "foobar"
