Free Tool
Regex Tester
Test regular expressions with real-time match highlighting. Free, instant.
//gm
Common regex patterns cheat sheet
| Pattern | Description | Example Match |
|---|---|---|
. | Any character (except newline) | a, 1, @ |
\d | Any digit (0-9) | 3, 7 |
\w | Word character (a-z, A-Z, 0-9, _) | hello |
\s | Whitespace (space, tab, newline) | (space) |
^ | Start of string/line | Start |
$ | End of string/line | end |
[abc] | Any of a, b, or c | a |
(a|b) | a or b (capturing group) | a |
a{2,4} | 2 to 4 repetitions of a | aaa |
a+ | 1 or more of a | aaa |
a* | 0 or more of a | (empty), aaa |
a? | 0 or 1 of a | (empty), a |
How to use the regex tester
- Enter your regular expression in the pattern field
- Toggle flags (global, case insensitive, multiline, dotall) as needed
- Enter or paste test text — matches highlight in real time
- View match details including index positions and capture groups
Frequently Asked Questions
What are regex flags?
Flags modify how the regex engine processes the pattern. The most common are:g (global — find all matches), i (case insensitive),m (multiline — ^ and $ match line boundaries), and s(dotall — . matches newlines).
Why is my regex not matching?
Common issues: forgetting the g flag (only finds first match), not escaping special characters like . or (, and not enabling the m flag when using ^ or $ with multiline text.