Regex Tester

· Free browser tool

A regex tester compiles a regular expression against sample text and shows exactly what it matches, character by character, before that pattern ever runs in a redirect rule, log filter, or analytics segment. SEO work is full of regular expressions, in Google Search Console filters, Google Analytics 4 segments, robots.txt path rules, and Apache or Nginx rewrites, and a pattern that is one character wrong can silently match nothing or match far too much.

This free, browser-based tester builds your expression with new RegExp in real time, toggles every JavaScript flag, and renders each match with its position and capture groups so you can confirm the behaviour before you ship it. Nothing you type is uploaded, which makes it safe for live URLs and internal data.

Regex TesterFree · client-side
/ /g
Highlighted matches
Match details

🔒 Private: everything runs in your browser. Nothing you paste is uploaded.

How to use the regex tester

Type a pattern, toggle the flags you need, and paste the text you want to match against. The highlight panel and match list update on every keystroke, and an invalid pattern shows the exact engine error instead of failing silently.

Build the pattern and read the live error message

Enter the expression in the pattern field, without the surrounding slashes, and watch the status pill. The tool calls new RegExp(pattern, flags) inside a try/catch on every keystroke, so a malformed expression such as an unclosed group turns the pill red and prints the engine’s own error, like “Unterminated group”, rather than just doing nothing. A green pill confirms the pattern compiled and tells you how many matches it found in the test text, which is the fastest way to catch a typo before the regex reaches production.

Toggle the flags that change how matching works

Flags change the engine’s behaviour and are a frequent source of bugs. The g flag finds every match instead of just the first, i ignores case, m makes the anchors ^ and $ match per line, and s lets the dot match newlines. The u flag enables full Unicode handling and y anchors matching at the current position. Each toggle re-runs the test instantly, so you can see precisely how adding or removing a flag widens or narrows the result set.

Inspect every match, its index, and its capture groups

The highlight panel marks each match in the text with alternating colours, and the detail cards below list every match with its start and end index plus the contents of each capture group. Numbered groups appear as Group 1, Group 2, and so on, while named groups written as (?<tld>...) are listed by name. Groups that did not participate show as undefined, which is exactly how the engine reports them, so you can debug why a backreference or replacement is pulling the wrong text.

Regex tester frequently asked questions

Q1Which regex flavour does this tester use?

It uses the JavaScript regular expression engine built into your browser, the same one behind every modern site. JavaScript regex covers the syntax most SEO and analytics tools expect, including capture groups, lookaheads, and Unicode property escapes. It differs slightly from PCRE or RE2 flavours used elsewhere, so for Google Analytics 4 or RE2-based filters confirm advanced constructs such as lookbehind separately.

Q2What do the g, i, m, s, u, and y flags do?

The g flag returns every match instead of the first, i makes matching case-insensitive, and m makes the anchors caret and dollar match the start and end of each line. The s flag lets the dot match newline characters, u turns on full Unicode mode, and y makes matching sticky at the current position. Toggle each one to see how it changes the result set live.

Q3Is my test text sent to a server?

No. The entire tester runs as client-side JavaScript in your browser, and the pattern and test text are never uploaded, logged, or stored anywhere. The tool keeps working even with your network disconnected once the page has loaded. That makes it safe to test patterns against confidential URLs, internal paths, or private log samples without exposing them.

Q4How do I read named and numbered capture groups?

Each parenthesis group in your pattern becomes a numbered capture, listed as Group 1, Group 2, and onward in match order. Writing a group as a named capture, using the syntax with a name in angle brackets, also lists it by that name. A group that did not participate in the match shows as undefined, which is the engine’s own way of reporting an optional group that was skipped.

Q5Why does my pattern match nothing or match too much?

The two most common causes are flags and greediness. Without the g flag you only ever see the first match, and forgetting i means a case mismatch returns nothing. Matching too much usually means a greedy quantifier such as dot-star is consuming more than intended; switch it to a lazy quantifier or tighten the character class. The live highlight shows exactly which characters were consumed.

Hristo Bogdanov, Head of SEO at SEO Domains

Hristo Bogdanov

Head of SEO @ SEO Domains · CEO & Co-founder of SEO.bo

Hristo has spent 15+ years building aged-domain acquisition and screening workflows for SEO professionals, brand owners, and domain investors, and builds the free tooling SEO Domains publishes for practitioners.