🔎Regex Tester

Test regular expressions live — highlight matches, inspect capture groups, and preview replacements.

/ /
Flags
Test String
Highlighted Matches
Matches will be highlighted here…
Characters
.Any character except newline
\dDigit [0–9]
\DNon-digit
\wWord char [a-zA-Z0-9_]
\WNon-word char
\sWhitespace (space, tab, newline)
\SNon-whitespace
\nNewline
\tTab
Anchors
^Start of string (or line with m)
$End of string (or line with m)
\bWord boundary
\BNon-word boundary
Quantifiers
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{n}Exactly n times
{n,m}Between n and m times
*?0 or more (lazy)
+?1 or more (lazy)
Groups & Sets
[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Any char a through z
(abc)Capture group
(?<n>…)Named capture group
(?:…)Non-capturing group
a|bAlternation: a or b
Lookaround
(?=…)Lookahead (match if followed by)
(?!…)Negative lookahead
(?<=…)Lookbehind
(?<!…)Negative lookbehind
Replace references
$1 $2Numbered capture group
$<n>Named capture group
$&Entire match
$$Literal $

Regex tester online — test regular expressions in your browser

Debugging a regular expression? Our free regex tester shows you exactly what your pattern matches, live. Type your regex and a test string, and every match is highlighted instantly — no running, no guessing. Toggle flags like global, case-insensitive, and multiline, and watch the results update in real time.

It goes beyond highlighting. A match list breaks down each result with its position, the full match, and every capture group — including named groups — so you can see precisely what your pattern is capturing. Invalid patterns get a clear error message instead of a cryptic failure, and a built-in cheat sheet of common tokens is there when you need a reminder. You can also test replacements to preview the output with $1 and $<name> references.

Whether you're writing validation, parsing text, or learning regex, this online regex tester makes the whole process visible. Simply enter a pattern and some text to test it instantly. No sign-up, no downloads, no limits — your patterns and test data stay in your browser, privately.

About the Regex Tester

Features

Live Highlighting

Every match is highlighted in a preview pane as you type. First match is marked in green; subsequent matches in yellow. Updates in real time with a short debounce.

Flag Toggles

Toggle the six standard JavaScript regex flags — global (g), case-insensitive (i), multiline (m), dotall (s), unicode (u), and sticky (y) — with a single click.

Capture Groups

The match list shows numbered capture groups ($1, $2, …) and named groups (?<name>…) for every match, so you can see exactly what each group captured.

Replace Mode

Switch to Replace mode to preview the result of String.replace with your pattern. Supports $1, $<name>, $& (full match), and $$ (literal dollar sign).

Error Handling

Invalid patterns show a clear inline error with the engine's exact message instead of crashing or freezing. A length guard on the test string prevents runaway patterns from hanging the tab.

Cheat Sheet

A collapsible cheat sheet covers character classes, anchors, quantifiers, groups, sets, lookaround, and replace references — a quick reference without leaving the page.

Privacy

Patterns and test strings can be sensitive — API keys, PII patterns, internal data formats. The Regex Tester is fully client-side: it makes no network requests with your input. Nothing is logged, stored, or sent anywhere. You can verify this by watching the Network tab in your browser's DevTools.

Frequently Asked Questions

How does the regex tester work?

Enter a regular expression and a test string. Matches are highlighted live and listed with their positions and capture groups, updating as you type — no button to press.

Is the regex tester free?

Completely free, no sign-up, downloads, or limits.

Which flags are supported?

The standard JavaScript flags: global (g), case-insensitive (i), multiline (m), dotall (s), unicode (u), and sticky (y). Click each flag button to toggle it on or off.

Does it show capture groups?

Yes. Each match in the match list shows its numbered capture groups ($1, $2, …) and any named groups defined with (?<name>…).

What regex flavor does it use?

It uses the JavaScript (ECMAScript) regex engine — the same one that runs in all modern browsers and in Node.js.

What happens if my regex is invalid?

A clear error message appears below the pattern field showing exactly what the JavaScript engine reported, so you can fix the pattern without the tool crashing or freezing.

Can I test replacements?

Yes. Switch to Replace mode using the tabs above the test area, then enter a replacement string. It supports $1, $2 (numbered groups), $<name> (named groups), $& (full match), and $$ (literal dollar sign).

Is my data sent anywhere?

No. Everything runs locally in your browser using the JavaScript regex engine. Your patterns and test text never leave your device.

Is my data stored?

No. Nothing is stored or persisted. Closing or refreshing the page clears everything.

Does it work on mobile?

Yes. The pattern input, flag toggles, test area, and match list are all fully responsive and fit on small screens without horizontal overflow.