A regex tester is a free online tool that lets you try a regular expression against your own text and see every match highlighted instantly. It reports the match count, lists capture groups for each match, and includes a quick-reference cheat sheet, so you can build and debug patterns without guessing.
Matches will be highlighted here...
- No matches yet.
Regex cheat sheet
| Token | Meaning |
|---|---|
. | Any character (with s flag, including newlines) |
\d \w \s | Digit, word character, whitespace |
\D \W \S | Not a digit, not a word char, not whitespace |
[abc] [^abc] | Character class / negated class |
* + ? | Zero or more, one or more, zero or one |
{n} {n,} {n,m} | Exact / at least n / between n and m |
*? +? ?? | Lazy (non-greedy) versions |
^ $ | Start / end of string (or line with m flag) |
\b | Word boundary |
( ) (?: ) | Capture group / non-capturing group |
(?<name>) | Named capture group |
a|b | Alternation (a or b) |
\1 | Backreference to group 1 |
(?= ) (?!) | Lookahead / negative lookahead |
How do I test a regex online?
Type your pattern in the pattern box (no slashes needed), tick the flags you want, and paste your test string below. Every match highlights instantly in yellow, the match count updates, and each match capture groups are listed underneath.
This tester uses the JavaScript RegExp engine, the same one your browser runs. Patterns behave like new RegExp(pattern, flags). Remember that without the g flag only the first match is found, which is why g is on by default.
What do the regex flags g, i, m, and s do?
The g flag finds all matches instead of stopping at the first. The i flag makes matching case-insensitive. The m flag lets ^ and $ match at line boundaries, not just string boundaries. The s flag lets the dot match newline characters too.
A classic gotcha: . does not match newlines unless s is set, so multi-line patterns silently fail without it. Another: ^ only matches the string start unless m is on, which matters when your test string has multiple lines.
Frequently asked questions
Is this regex tester free?
Yes. Test unlimited patterns with no account and no limits. It runs entirely in your browser.
Which regex flavor does it use?
JavaScript (the RegExp engine). Most common syntax works the same in other flavors, but advanced features like lookbehind support vary.
Why does my pattern show "Invalid regular expression"?
The pattern has a syntax error: an unclosed group or class, a stray backslash, or a bad quantifier. The message names the problem so you can fix it.
How do I match across multiple lines?
Tick the s (dotAll) flag so . matches newlines, and the m flag if you use ^ and $ per line. Then test against your multi-line string.
Is my test data uploaded anywhere?
No. All matching happens locally in your browser. Your patterns and text never leave your device.