Regex Tester

Live matches, capture groups, and replace — as you type.

Your data is processed entirely in your browser and is never uploaded.

Tool workspace

TEST STRING

Drag & drop file here or browse

No pattern yet0 chars

Pattern

Flags
Replace
0 matches
Local sandbox active
MATCHES
          
HOW IT WORKS

Test a regex in three steps

Write the pattern

Type your expression between the slashes and toggle the flags you need.

Paste the text

Matches highlight live, with capture groups and named groups listed per match.

Replace or copy

Preview a replacement with $1 / $& support, then copy the result.

Docs · Regex

How the tester matches

The tester compiles your pattern with the browser's native RegExp engine and runs it against the test string as you type — no server, no upload. Every match highlights in the view, and each match lists its capture groups, numbered ($1, $2…) and named. Flags reshape how the same pattern behaves: g returns every match instead of stopping at the first, i ignores case, m makes ^ and $ match line boundaries, s lets . cross newlines, u switches on full Unicode, and y pins the match to the current position. Load any snippet below with "try it" — the pattern and the test text both fill in, and the matches light up.

Things to know

Unescaped specials match too much

Characters like . * + ? ( ) [ ] { } ^ $ | carry meaning. A bare . matches ANY character, not a period. Load this, then delete the backslash before the dot and watch file-txt start matching too — backslash a special to match it literally.

\.
file.txt
file-txt
Groups capture pieces

( ) captures a numbered group — $1, $2…; (?<name> ) captures a named one. Load this and open a match card to see both the numbered groups and name / role appear by name.

(?<name>[A-Za-z]+), ([a-z]+)
Ada, engineer
Grace, admiral
Flags reshape the match

The same pattern matches different text under different flags. Load this, then toggle i and watch ADA match; toggle g off and only the first match is returned.

ada
Ada and ada and ADA
A pattern can hang the tab

Nested quantifiers like (a+)+b can backtrack explosively on near-matching text — catastrophic backtracking. The test string is capped at 500k characters to bound the blast radius, but if a match seems to freeze, simplify the pattern. No runnable snippet here on purpose: we won't ship a hang.

Try these

Email addresses
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b
Reach us at support@freejsontoolkit.com or sales@example.org — @missing.com stays unmatched.

Word boundaries stop it matching inside longer tokens; [A-Za-z]{2,} requires a real TLD — @missing.com stays unmatched.

Dates into named groups
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
Shipped 2026-08-03, patched 2025-12-31.

Named groups land in each match card by name — year, month, day.

Every number
\d+(\.\d+)?
3 items at 4.99 each, 1 at 12, tax 1.05

With g on, all of them light up; toggle it off to keep just the first.

pair this withValidate structured data → JSON Validator·Encode the result → Base64 Encode / Decode·Percent-encode it → URL Encode / Decode

FAQ

Frequently asked questions

Is my text uploaded anywhere?

No. Matching runs entirely in your browser using the native RegExp engine. Your pattern and text never leave your machine.

Which regex flavor is this?

JavaScript (ECMAScript) regular expressions — the same engine your browser runs. Lookbehind, named groups, and the u/s flags are all supported.

Can a pattern freeze the tab?

A pathological pattern with nested quantifiers can backtrack heavily (this is true of any regex engine). The test string is capped at 500k characters to bound the work; if a match seems to hang, simplify the pattern.

What do the replace tokens mean?

$1$9 insert capture groups, $& inserts the whole match, and $$ inserts a literal dollar sign — standard JavaScript replace syntax.