Write a regex, see what it hits
Paste a pattern, paste some text. Hits highlight live, and each one becomes a card with capture groups and position.
Regular expression
no surrounding slashes neededTest text
paste anything; it reruns as you typeMatches
one card per hitYour pattern and text stay in this browser. Nothing is uploaded, and there's no account. Clearing site data or switching devices will lose them. Use "Clear my data" in the footer to wipe everything.
Change one character, see the whole picture
The usual debugging loop is a console, a console.log line, run, squint. Tweak one character and you do the whole dance again. Counting match indexes by hand makes it worse.
Here three things sit side by side: the preview highlights the hits, the stream gives every match its own card, and capture groups are listed as $1, $2 right on the card. All three refresh while you type.
Flags are not decoration
g decides one match or all of them, i handles case, m makes ^ and $ respect every line. s is the one people forget — without it, . refuses to cross a newline and every multiline match falls short.
Hover or focus a flag button and the small line below explains what it does.
Empty matches are shown, not hidden
A pattern like (\d*) matches at every position, and you get a stream of empty hits. This tool does not hide them — empty matches get cards too, with exact positions. That beats "it should match but shows nothing".
Common questions
Why does my regex match an empty string?
Usually a quantifier sits on something optional, like (\d*), which matches at any position. Tighten it to \d+, or check whether a ? applies to a whole group. The tool shows empty matches as they are, with positions, so they are easy to spot.
What does the g flag actually change?
Without g you get only the first match of the whole text. With g, the engine scans to the end and every hit gets its own card. Same for the replacement preview: with g everything is replaced, without it only the first occurrence.
Do my pattern and text get uploaded?
No. Matching runs on your browser's own regex engine and the page sends no requests. Pattern, text and flags live in this device's localStorage, so they survive a refresh. Use "Clear my data" in the footer to wipe them.
Are lookarounds supported?
Yes. (?=...) and (?!...) plus (?<=...) and (?
How does replacement work?
Type into the replace box and the full rewritten text appears below. $1 and $2 stand for capture groups; leave it empty to delete matches, or write $2 $1 to swap them.