Developer Runs in your browser 100% Private

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 Data
//gm
Presets
Matches
5
Capture groups
6
Characters tested
125

Test text

Parameters & Settings

Include the strings you expect to fail, not only the ones you expect to match

Matches

Results & Output
Invoice 2026-09-18 issued, due 2026-10-18. Previous invoice 2026-08-14 was settled on 2026-08-29. Contract renews 2027-01-01.
#IndexMatchGroup 1Group 2Group 3yearmonthday
182026-09-182026091820260918
2312026-10-182026101820261018
3602026-08-142026081420260814
4862026-08-292026082920260829
51142027-01-012027010120270101
Quick Answer

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

  1. Write the pattern: Enter your expression and toggle the flags you need.
  2. Add test text: Paste the strings you expect to match — and the ones you do not.
  3. Inspect matches: Matches highlight live; the table lists every capture group by index and name.
  4. Try a replacement: Enter a replacement string with $1 or named references to preview the substituted text.
Technical Architecture & Logic

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.

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.

Published , last reviewed . The formulas and assumptions behind this tool are verified for mathematical accuracy.