Cheatsheet Pages / Regex Cheatsheet

Lookbehind in regex: require (or forbid) what precedes — (?<=...) and (?<!...)

The number counts only when a dollar sign stands before it; the word only when 'not' does not.

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+
# matches "42" in "$42" — the $ itself is not part of the match
(?<!not )good
# "good" in "very good" but not in "not good"

Good to know

JavaScript lookbehind needs ES2018+ (older Safari lacks it); Python's re requires fixed-width lookbehind, while PCRE is more lenient.

Regex Cheatsheet one-page card — patterns that actually work
The full one-page card — Regex Cheatsheet. Get the complete cheatsheet on GitHub