~/allthedamn.tools

Regex Tester

Watch the matches light up, then see the same pattern drawn as track you can read.

runs entirely in your browser
start from
2 matches · 2 groups
Ping ada@lovelace.dev when the nightly build goes red. After ten minutes escalate to on-call+pager@example.co.uk as well. Everyone else can wait for the morning digest.
ada@lovelace.dev
match 1 · at 5
group 1 «user»ada
group 2 «domain»lovelace.dev
on-call+pager@example.co.uk
match 2 · at 85
group 1 «user»on-call+pager
group 2 «domain»example.co.uk

Railroad diagram

drawing

Diagram style adapted from Regexper (MIT, © Jeffrey Avallone).

Matched by your own browser’s regular-expression engine. Nothing you type leaves this page. Tester interaction model adapted from delphitools (MIT).

Reading the diagram

A railroad diagram draws the regex as track: enter on the left, leave on the right, and every route between is a string that matches. Boxes must be consumed, stacked branches are an alternation, a rail looping back is a repetition, and an arc over the top means optional.

A dashed outline consumes nothing — captioned it is a group or lookaround, alone it is an anchor. Boxes say what they mean (\d reads as digit) and follow the flags: turn on s and "any character except newline" becomes "any character". regex101 and RegExr run patterns without drawing them; Regexper draws without running. Here both update on the same keystroke.

JavaScript's engine, not an imitation of it

Patterns run in your own browser's RegExp, unedited — nothing is repaired, rewritten or normalised on the way in, because a tester that quietly fixed your pattern would teach you a pattern that does not exist. What this page reports is what your code will do, including the parts you would rather it did not.

So the flags are honest too. Without g (or sticky y) you get one match, because one match is all your code would get. Hover any flag chip for what it does and an example of it doing it. When a pattern will not compile, the line under the field is the engine's own SyntaxError, word for word — the same message you will meet in your console.

Empty matches, capture groups, replace

A pattern can match without consuming anything, and those land as a thin bar marked zero-width rather than an invisible highlight. The trap is the exec loop: a global regex that matches nothing matches at the same index forever unless you advance it by hand. This page advances exactly as the engine does — one UTF-16 unit normally, a whole code point once u or v is on, so an emoji is stepped over rather than landed inside.

Every capture group gets a row under its match, numbered as $1 and $2 and named if you wrote (?<name>…); a group that never ran says so instead of showing an empty string. Replace mode uses the same substitution syntax as String.prototype.replace — $1, $<name>, $& and $$. The scan stops after five thousand matches and says that it stopped.

fair questions

What flavour of regex does this tester use?
JavaScript's own, run by the browser you are reading this in: no atomic groups, no possessive quantifiers, no recursion, but full lookbehind, named groups, and ES2025 modifier groups like (?i:abc). For Python, PHP or Go, treat the results as a close guide, not a guarantee.
What is a railroad diagram?
A drawing of the pattern as track: enter left, leave right, and every path between is a string that matches. Branches are alternations, a loop is a repetition, an arc over the top is optional, and a dashed outline consumes nothing (a group, lookaround or anchor).
Why does my regex match empty strings?
Because the pattern is allowed to. Quantifiers like * succeed on zero characters, and assertions such as \b never consume any. This page marks those zero-width rather than hiding them. If you meant at least one character, use + instead of *.
Why am I only getting one match?
The g flag is off and sticky y is not on either, so JavaScript reports the first match and stops — exactly what your own code would do. Turn g on and every match is highlighted.
How do I test a replacement?
Switch to replace and type the replacement string: $1 for the first captured group, $<name> for a named one, $& for the whole match, $$ for a literal dollar sign. The g flag decides whether one match or all of them are replaced.
Can I export the diagram?
Yes — SVG to scale or edit, PNG to paste into a doc or a pull request. Both are generated in the page, with colours written as literal values so the file looks right anywhere.
Is my pattern or test data uploaded anywhere?
No. Matching is done by your browser's regex engine and the diagram is drawn in the page. Nothing you type is sent anywhere, and the tool keeps working with the network disconnected.