Regex Tester & Explainer
Test a regular expression against your own text with live match highlighting, a table of every capture group by index and name, a plain-English breakdown of what the pattern does, and a replacement preview. It runs on your browser’s own RegExp engine, so what you see here is exactly what your JavaScript will do.
- Price:
- Free, no sign-up
- Data:
- Processed locally
- Reviewed:
Interactive regex tester
Pattern
Input DataTest text
Parameters & SettingsInclude the strings you expect to fail, not only the ones you expect to match
Matches
Results & Output| # | Index | Match | Group 1 | Group 2 | Group 3 | year | month | day |
|---|---|---|---|---|---|---|---|---|
| 1 | 8 | 2026-09-18 | 2026 | 09 | 18 | 2026 | 09 | 18 |
| 2 | 31 | 2026-10-18 | 2026 | 10 | 18 | 2026 | 10 | 18 |
| 3 | 60 | 2026-08-14 | 2026 | 08 | 14 | 2026 | 08 | 14 |
| 4 | 86 | 2026-08-29 | 2026 | 08 | 29 | 2026 | 08 | 29 |
| 5 | 114 | 2027-01-01 | 2027 | 01 | 01 | 2027 | 01 | 01 |
How do I test a regular expression?
Enter the pattern, toggle the flags you need, then paste text that should match alongside text that should not. Matches highlight as you type and every capture group is listed separately. Patterns that backtrack catastrophically are stopped by a step budget rather than freezing the tab, which is also a useful warning about the pattern itself.
How to use the regex tester
- Write the pattern: Enter your expression and toggle the flags you need.
- Add test text: Paste the strings you expect to match — and the ones you do not.
- Inspect matches: Matches highlight live; the table lists every capture group by index and name.
- Try a replacement: Enter a replacement string with $1 or named references to preview the substituted text.
How the regex tester works
Reading a regular expression
A pattern is a small program. The explainer below the input decomposes yours into tokens and describes each — literal characters, character classes, quantifiers, groups, anchors and assertions — in the order the engine will apply them.
Greedy, lazy and possessive
.* is greedy: it consumes to the end of the line, then backtracks until the rest of the pattern can match. .*? is lazy: it consumes as little as possible and extends only when forced. The difference shows up immediately when parsing delimited text — <.*> against <a><b> matches the whole string, while <.*?> matches just <a>.
Catastrophic backtracking
Nested quantifiers over overlapping character sets — the classic (a+)+b — can make the engine explore exponentially many ways to split the input before concluding there is no match. On a 30-character non-matching string that is already billions of steps. The fix is usually to make the inner and outer sets disjoint, or to anchor the pattern so failure is detected early.
Capture groups
(...) captures, (?:...) groups without capturing, and named groups capture by name. Prefer named groups in anything you will read again in six months, and prefer non-capturing groups where you only need precedence — it keeps the group indices stable when you edit the pattern later.
Regex Tester — frequently asked questions
JavaScript (ECMAScript), running on your browser own RegExp engine — so what you see here is exactly what your JS or TypeScript code will do. Most patterns transfer to PCRE, Python and Go, but lookbehind, named groups and Unicode property escapes vary in support.
Catastrophic backtracking is real, so matching runs under a step budget and a match count cap. If a pattern exceeds the budget the tool stops and warns you rather than freezing the tab — which is also a useful signal that the pattern would be a denial-of-service risk in production.
g finds all matches rather than the first; i ignores case; m makes ^ and $ match line boundaries; s lets . match newlines; u enables full Unicode handling. The u flag is worth defaulting to for any pattern touching non-ASCII text.
A group inside an alternation or an optional section that did not participate in the match returns undefined rather than an empty string. Distinguishing the two matters: undefined means this branch did not run, empty string means it ran and matched nothing.
Official resources & government references
Verified references, primary standards specifications, and official publications governing the rules and calculations implemented in this tool:
ECMA-262: Regular Expression Objects Specification
The definitive formal language specification governing JavaScript regular expression syntax and matching algorithms.
JavaScript Regular Expressions Developer Guide
Comprehensive documentation on character classes, lookaheads, lookbehinds, and Unicode flags.
Important Disclaimer
Regular expressions are evaluated client-side via ECMAScript RegExp semantics. Be aware that unbounded nested quantifiers can cause catastrophic backtracking (ReDoS) if deployed to untrusted user input on web servers.