Developer Tools
Regex Cheat Sheet
Interactive regular expression reference with live tester — anchors, character classes, quantifiers, groups, lookaheads, flags, and common patterns
Trusted by 10k+ developers
Live Regex Tester
//
Hello World 123
1 match"123" @12
Anchors
Start of string (or line with m flag)
e.g. ^Hello
End of string (or line with m flag)
e.g. world$
Word boundary
e.g. \bword\b
Not a word boundary
e.g. \Bend
Start of string (no multiline)
e.g. \AHello
End of string (no multiline)
e.g. world\Z
Character Classes
Any character except newline
e.g. a.c
Word character [a-zA-Z0-9_]
e.g. \w+
Non-word character
e.g. \W+
Digit [0-9]
e.g. \d{3}
Non-digit
e.g. \D+
Whitespace (space, tab, newline)
e.g. \s+
Non-whitespace
e.g. \S+
Any of a, b, or c
e.g. [aeiou]
Not a, b, or c
e.g. [^0-9]
Character in range a to z
e.g. [a-zA-Z]
Chinese characters (Unicode range)
e.g. [\u4e00-\u9fff]+
Quantifiers
0 or more of a (greedy)
e.g. ab*c
1 or more of a (greedy)
e.g. ab+c
0 or 1 of a (optional)
e.g. colou?r
Exactly 3 of a
e.g. \d{4}
3 or more of a
e.g. \w{3,}
Between 3 and 6 of a
e.g. \d{2,4}
0 or more of a (lazy/non-greedy)
e.g. <.*?>
1 or more of a (lazy)
e.g. \d+?
Groups & Capturing
Capture group
e.g. (\d+)-(\w+)
Non-capturing group
e.g. (?:https?)
Named capture group
e.g. (?<year>\d{4})
Backreference to group 1
e.g. (\w+)\s\1
Positive lookahead
e.g. \d(?=px)
Negative lookahead
e.g. \d(?!em)
Positive lookbehind
e.g. (?<=\$)\d+
Negative lookbehind
e.g. (?<!\$)\d+
a or b (alternation)
e.g. cat|dog
Escape Characters
Newline
e.g. line1\nline2
Tab
e.g. col1\tcol2
Carriage return
e.g. \r\n
Literal dot
e.g. \d+\.\d+
Literal asterisk
e.g. \*important\*
Literal parenthesis
e.g. func\(\)
Flags
Global + case-insensitive
e.g. /hello/gi
Multiline (^ and $ match line start/end)
e.g. /^\w+/m
Dotall (. matches newline too)
e.g. /a.b/s
Unicode (enable Unicode support)
e.g. /\p{L}/u
Unicode sets (advanced, ES2024)
e.g. /[\p{Emoji}]/v
Common Patterns
Email address
e.g. user@example.com
HTTP/HTTPS URL
e.g. https://example.com
Phone number (E.164)
e.g. +12345678901
Date (YYYY-MM-DD)
e.g. 2024-04-01
Hex color (without #)
e.g. ff5733
Password: min 8 chars, 1 uppercase, 1 digit
e.g. Password1
IPv4 address (basic)
e.g. 192.168.1.1
URL slug
e.g. my-blog-post
HTML comment
e.g. <!-- comment -->
CSS hex color with #
e.g. #ff5733
IPv4 address (strict-ish)
e.g. 10.0.0.1
Username (3-16 chars)
e.g. user_name-1
Continue Exploring
Other Developer Tools you might like...
JSON Formatter
Format, validate, and minify JSON data with syntax highlighting
Try Now
Base64 Encoder/Decoder
Encode text to Base64 and decode Base64 strings
Try Now
URL Encoder/Decoder
Encode and decode URL components and query strings
Try Now
UUID Generator
Generate random UUID v4 identifiers
Try Now
Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text
Try Now
Regex Tester
Test and debug regular expressions with match highlighting
Try Now
JWT Decoder
Decode and inspect JWT token header and payload
Try Now
HTML Formatter
Beautify and format HTML code with proper indentation
Try Now