Cheatsheet Pages / Regex Cheatsheet

How to match one character from a set — [...] and [^...]

Any vowel, any letter — or any character that is NOT a digit: a set, or everything except a set.

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.

[aeiou]
# any single vowel
[a-zA-Z]
# any single letter
gr[ae]y
# "gray" or "grey"
[^0-9]
# same as \D — any non-digit
[^<>]*
# any run of characters that aren't angle brackets

Good to know

Inside a class most metacharacters lose their magic (. is literal), but ] \ ^ and - still need care; a ^ only means 'not' when it is the first character inside the brackets.

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