Regex Tester
Tests a regular expression against sample text with live match highlighting and capture group listing.
Runs a regular expression against sample text and shows every match with its offsets, its capture groups and the replacement it would produce. It is the browser’s own engine, so what happens here is what will happen in your JavaScript.
Pattern
can match anywhere in the string, 2 capture groups.
Test against
Every match is listed. Without the `g` flag, `String.replace` only uses the first.
0 matches
Time
0.0 ms
ask@example.com, 문의@example.co.kr and no-reply+tag@mail.example.orgReplace
`$1`, `$<name>`, `$&`, `` $` ``, `$'` and `$$` all expand, exactly as `String.replace` expands them.
How to use it
Write the pattern and set the flags
The flag buttons are the six that matter: global, ignore case, multiline, dotAll, unicode and sticky. The literal at the top is what you would paste into code.
Paste text you actually have
Matches are highlighted in place, alternating colour so adjacent ones are distinguishable, and listed in a table with each group’s value — including the groups that did not participate.
Try the replacement
`$1`, `$<name>`, `$&`, `` $` ``, `$'` and `$$` all expand exactly as `String.replace` expands them, so the preview is the real output.
Common questions
Why does the page warn about a missing `g` flag?
Because the list shows every match, but without `g` your code will not. `String.replace` changes only the first, and `matchAll` throws outright. It is the difference between what you see here and what your program does.
Is this the same engine as Python or PCRE?
No — it is JavaScript’s. Lookbehind, named groups and `\p{…}` are supported here, but atomic groups, possessive quantifiers, recursion and inline flag groups are not, and character-class behaviour differs in places. A pattern that works here can still fail elsewhere.
My pattern hangs the page.
It should not — matching runs in a worker precisely because a catastrophically backtracking pattern cannot be interrupted any other way. If it takes too long the run is terminated and reported, which is also a useful signal: a pattern that does that here will do it on your server.
Why does `.` not match my newline?
Because that is what `s` (dotAll) is for. Without it `.` matches anything except a line terminator — and `m` (multiline) is a different thing again: it changes what `^` and `$` mean, not what `.` matches.
Feed it from
Find & Replace
Replaces text by literal, whole word or regular expression, with capture groups and a preview of every hit.
Pattern Extractor
Pulls every email, URL, number, date or custom regex match out of a blob of text into a list.
Regex Explainer
Breaks a regular expression into a labelled tree so you can read what each part actually matches.
JSON Formatter & Validator
Pretty-prints, minifies and validates JSON, pointing at the exact line and column of a syntax error.
Next
These accept what this tool produces, so the result can go straight in.
Cron Parser
Explains a cron expression in plain language and lists the next runs in a chosen timezone.
Find & Replace
Replaces text by literal, whole word or regular expression, with capture groups and a preview of every hit.
Regex Explainer
Breaks a regular expression into a labelled tree so you can read what each part actually matches.
Pattern Extractor
Pulls every email, URL, number, date or custom regex match out of a blob of text into a list.
JSON ⇄ CSV
Flattens nested JSON into columns or rebuilds objects from a table, with a dot-path column naming rule.
JSON Diff
Compares two JSON documents structurally, ignoring key order and reporting added, removed and changed paths.