Regex Cheatsheet
Runs locallyA quick reference of regex character classes, quantifiers, anchors, groups and flags
Character classes
.Any single character except newline
a.c → abc\dA single digit
\d{3} → 123\wLetter, digit or underscore
\w+ → abc_1\sAny whitespace character
a\sb → a b[abc]Any one character in the set
[aeiou] → e[^abc]Any character not in the set
[^0-9] → a[a-z]Any character in the range
[A-F] → CQuantifiers
*Zero or more times
ab* → abbb+One or more times
ab+ → abbb?Zero or one time
colou?r → color{n,m}Between n and m times
\d{2,4} → 2024*?Lazy match, as few as possible
<.*?> → <b>Anchors and boundaries
^Start of the string
^Hello$End of the string
world$\bWord boundary
\bword\bGroups and lookaround
( )Numbered capturing group
(\d+)-(\d+)(?: )Group without capturing
(?:ab)+(?<name> )Named capturing group
(?<year>\d{4})a|bMatch either alternative
cat|dog(?= )Positive lookahead
\d(?=px)Flags
gMatch all occurrences
/a/giCase-insensitive matching
/abc/imMulti-line mode
/^a/msLet the dot match newlines
/a.b/sHow to use
- 1
Paste or type the content you want to process
- 2
Pick your options (indent size, key sorting and more)
- 3
Check the result and copy it in one click
Privacy
Everything is processed locally in your browser and never uploaded to any server.