What is this regex tester?
A regular expression (regex) is a compact pattern language for matching text — used in form validation,
log parsing, find-and-replace, data extraction, and input sanitization. This tool runs JavaScript's
built-in RegExp engine directly in your browser: type a pattern, choose flags, and paste
test text to see live matches, capture groups, and a token-by-token explanation of what the pattern does.
Unlike most regex testers, this one doesn't just show you matches — it teaches you the pattern by naming
every piece of it in plain English, so you can learn regex syntax while you debug it.
How to use it
Type or paste a pattern into the /pattern/ field (without the surrounding slashes) and set
flags such as g for global matching or i for case-insensitive matching. Paste
your text into the test box below. Matches highlight instantly in alternating colors, capture groups —
both numbered (match[1]) and named (match.groups.name) — appear in a table per
match, and the explainer panel breaks the pattern into its component tokens with a description of each.
Click any example chip to load a ready-made pattern, flags, and test text for common validation tasks
like emails, URLs, dates, phone numbers, hex colors, and IPv4 addresses.
Two worked examples
Example 1 — extracting a date
Example 2 — validating a username
Why a plain-English explainer matters
Regex is famously write-once, read-never: a pattern that made sense while you wrote it can look like line noise a week later, and reviewing someone else's pattern in a pull request is worse. The explainer in this tool walks the pattern the same way the regex engine itself does — token by token, respecting nesting — so a lookahead, a named group, and a lazy quantifier are each called out individually instead of being lumped into one wall of text. That makes it useful both for debugging your own patterns and for understanding a pattern you copied from somewhere else before you trust it in production code.
FAQ
What regex flavor does this tool use?
It uses JavaScript's native RegExp engine, the same one that runs in every browser and in Node.js. That means the matching behavior, flags (g, i, m, s, u, y, d), named groups, lookaheads and lookbehinds all match exactly what you'd get calling new RegExp() or String.prototype.match() in real JS code, with no server-side translation to another regex flavor like PCRE or Python's re.
How does the explainer figure out what my regex means?
The tool parses your pattern character by character into tokens — anchors, character classes, quantifiers, groups, alternation, escapes and backreferences — the same way a regex engine would tokenize it before compiling. Each token is matched against a plain-English description and grouped with correct nesting so you can see exactly which quantifier applies to which group.
What is the difference between a numbered and a named capture group?
Every parenthesized group (...) that isn't marked non-capturing with (?:...) gets a number based on position, starting at 1 — retrieved as match[1], match[2], and so on. A named group (?<year>\d{4}) also gets a name, retrieved as match.groups.year. The results table shows both for every captured group in every match.
Why does my pattern match differently with and without the g flag?
Without the global (g) flag, JavaScript's exec() and match() stop after the first match. With g, the tool repeatedly calls exec() advancing lastIndex each time, finding every non-overlapping match. Toggle g on if your pattern seems to "only find one result."
Does this tool send my text or pattern to a server?
No. Parsing, matching, and explaining all run in plain JavaScript inside your browser tab using the built-in RegExp object. There is no network request after the page loads, which makes it safe to test patterns against passwords, tokens, log lines, or other sensitive text.
Why does my regex throw a SyntaxError instead of matching?
JavaScript RegExp throws when the pattern is malformed — an unbalanced parenthesis, an unclosed character class, a quantifier with nothing to repeat, or an invalid escape with the u flag enabled (which is stricter). This tool shows the browser's own error message so you can see precisely what was rejected.