Cheatsheet Pages / Regex Cheatsheet

Regex quantifiers * + ? — zero or more, one or more, optional

A character or group should repeat: any number of times, at least once, or not at all.

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.

https?://
# "http://" or "https://" — the s is optional
\d+
# one or more digits: "5", "42", "007"
colou?r
# "color" or "colour"

Good to know

These are the three you will use most of the time.

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