Regex Cheat Sheet & Builder
Browse regex tokens, click to build, and try the result against a sample — all in one place.
Pattern
//
Presets
Character classes
Any character (except newline) h.t matches hat, hit | |
Any digit (0-9) | |
Any non-digit | |
Word char (a-z, A-Z, 0-9, _) | |
Non-word char | |
Whitespace | |
Non-whitespace | |
Any of a, b, or c | |
None of a, b, c | |
Range a through z |
Anchors
Start of string / line (m flag) | |
End of string / line (m flag) | |
Word boundary | |
Non-word boundary |
Quantifiers
0 or more (greedy) | |
1 or more (greedy) | |
0 or 1 (also makes others lazy) | |
Exactly n | |
n or more | |
Between n and m | |
Lazy 0 or more | |
Lazy 1 or more |
Groups
Capturing group | |
Non-capturing group | |
Named group | |
Back-reference to group 1 | |
Positive lookahead | |
Negative lookahead | |
Positive lookbehind | |
Negative lookbehind |
Escapes
Literal dot | |
Literal backslash | |
Newline | |
Tab | |
Carriage return | |
Unicode codepoint |
Flags
Global — find all matches | |
Case-insensitive | |
Multiline — ^ and $ match line breaks | |
Dotall — . matches newlines | |
Unicode | |
Sticky |
For free-form testing with capture-group inspection, use the Regex Tester.
You might also like
- Find & ReplaceBulk find-and-replace over text with optional regex, case sensitivity, and whole-word matching.
- Regex TesterTest JavaScript regular expressions with live match highlighting and capture groups.
- ANSI Escape StripperRemove ANSI color codes and terminal control sequences from CI logs or terminal captures.
- Comment Style ConverterTranslate //, #, --, ;, %, /* */, and <!-- --> comments between languages while preserving indentation.