Regex Tester

Type a regular expression and watch the matches light up in your test text — with a live count, the position of every match, and any capture groups it pulls out. No server, no waiting: it re-tests as you type.

What this regex tester does

A regular expression is a pattern that describes text: "one or more digits", "a word starting with a capital", "anything that looks like a date". Regexes are enormously powerful and notoriously unforgiving — a single wrong character changes the meaning completely, and the failure mode is silent: the pattern simply matches the wrong things, or nothing. The only sane way to write one is against real sample text with the matches made visible, which is what this page does. Type a pattern in the top box, paste text underneath, and every match is highlighted in place as you type, counted, and listed with its exact starting position and any capture groups it extracted. Change a character and the feedback is instant, so you can tighten or loosen the pattern and watch the effect — the way regexes are actually developed, compressed into one screen.

The tester runs JavaScript's regex engine, and it respects the flags you choose instead of silently forcing its own. That matters more than it sounds: with the g flag off, a search legitimately finds only the first match, and many a "bug" reported against a working pattern is really a missing flag. Here the four everyday flags — global, case-insensitive, multiline, and dotAll — are checkboxes, so the effect of each is one click away from being visible.

A pocket guide to the syntax

PatternMatches
\d / \w / \sA digit / a word character (letter, digit, underscore) / any whitespace
.Any character except a newline (every character at all, with the s flag)
* + ?Zero or more / one or more / zero or one of the thing before it
{2,4}Between 2 and 4 of the thing before it
[aeiou] / [^0-9]One character from the set / one character NOT in the set
^ / $Start / end of the text (of each line, with the m flag)
(abc)A capture group — the matched part is reported separately in the list above
a|bEither a or b
\. \* \\Literal dot, asterisk or backslash — special characters must be escaped to be literal

Three patterns worth trying

  • \d+ — every run of digits. Against the sample text it finds the three order numbers and the pieces of the date. It is the pattern this page opens with, and the classic first regex.
  • \b\w+@\w+\.\w+\b — a rough email shape. Paste a paragraph containing addresses and watch what it catches — and what it misses, like addresses with dots or plus signs before the @. Real email validation is famously a rabbit hole; a pattern like this is for finding, not for proving.
  • (\d{4})-(\d{2})-(\d{2}) — an ISO date with three capture groups. Run it on the sample text and the match list shows the year, month and day separately for 2026-11-01 — groups are how regexes stop being mere matchers and start extracting data.

Two habits will save you grief. Build patterns up in small pieces, checking the highlight after each addition, instead of writing twenty characters and debugging them all at once. And test against text that should not match as well as text that should — a pattern that matches everything has told you nothing.

Frequently asked questions

Which regex flavor does this tester use?

JavaScript's regular expression engine — the one used by browsers and Node.js. Most patterns behave identically in other flavors, but a few differ: JavaScript has no possessive quantifiers, uses \d \w \s with ASCII-centric meanings by default, and in this tester supports the g, i, m and s flags.

What do the flags mean?

g (global) finds every match instead of stopping at the first. i makes matching case-insensitive. m (multiline) makes ^ and $ match at line starts and ends, not just the whole text. s (dotAll) lets the dot match newline characters too. Without g, this tester reports just the first match, exactly as a single exec would.

Why does my pattern show matches that are empty?

Patterns that can match zero characters — like \d* or a? — match the empty string at every position. They are counted in the results list, but since an empty match has nothing to paint, the highlighted preview skips them. Anchor the pattern or require at least one character (use + instead of *) if empty matches are not what you want.

How do I match a literal dot or other special character?

Escape it with a backslash: \. matches a real period. The characters . * + ? ^ $ ( ) [ ] { } | \ all have special meanings in a pattern and must be escaped to be treated literally outside a character class.

Private by design: this tester runs entirely in your browser. The text you test here is never uploaded, stored or shared.