Developer · Patterns, tested safely

Regex Tester

Match, capture and replace without freezing the tab

Test a regular expression against your own text, inspect every capture group, and preview a replacement — with a timeout that survives a runaway pattern.

Live matchingCapture groupsReplace previewRunaway guard
Timeout
2 s
Max matches
1,000
Uploaded
0 B

Regex Tester

Runs in your browser · nothing uploaded
Matches
After replacement

01 — How to use Regex Tester

1 Write the pattern Type it into the bar at the top. A syntax error is reported with the engine’s own message, which usually names the exact problem.
2 Set the flags Global finds every match rather than the first. Ignore case, multiline, dot-all and unicode do what their names suggest — hover any of them for a one-line reminder.
3 Test against your own text Every match is listed with its position and the contents of each capture group, numbered and named.
4 Preview a replacement Switch to the Replacement tab to see the result of a substitution, with $1, $2 and $<name> inserting captures.

02 — Getting good results

A runaway pattern cannot freeze this page JavaScript offers no way to interrupt a regular expression once it starts, so a catastrophically backtracking pattern on the main thread locks the tab permanently — no scrolling, no typing, no cancel. Here the match runs in a worker that is given two seconds and then terminated. A pattern that would otherwise have required force-quitting the tab produces an error message instead.
The dangerous shape is a repetition inside a repetition Patterns like (a+)+ or (\d+)* ask the engine to find every way of splitting the input between the inner and outer repetition, and the number of ways grows exponentially with length. On text that nearly matches but ultimately fails, a twenty-character string can take longer than the age of the universe. The tool warns when it recognises the shape, though no static check catches every case — the timeout is the real protection.
An empty capture is not the same as no capture A group that participated in the match but captured nothing shows as ∅, while a group that did not participate at all is absent. The distinction matters when debugging optional groups, and it disappears entirely if both are rendered as an empty string.
Zero-width matches need care A pattern that can match nothing — a*, (?:), or a lookahead on its own — matches at every position including the end, which makes a naive global loop run forever. The matcher advances past a zero-width match explicitly. If you see one match per character, that is why, and it is correct rather than a bug.

03 — Questions

JavaScript’s, as implemented by your browser. That matters: JavaScript lacks some constructs found in PCRE, such as recursive patterns and possessive quantifiers, and lookbehind support varies by engine age. A pattern that works elsewhere may need adjusting here, and vice versa.

04 — More about Regex Tester

61 more tools
where this came from.

Same shell, same shortcuts, same promise: nothing leaves your browser.

Browse all 62