Regex Tester
Test regular expressions
About this tool
This free Regex Tester lets you build and debug regular expressions against real text, live. Enter a pattern, paste your test string, and see every match found, every capture group extracted, and every result explained — instantly, as you type. Nothing to install, no account needed; all matching runs on this page. Regular expressions are the most powerful text-processing tool in programming — and the least forgiving to write. A pattern is a dense dialect where every character has meaning: . matches any character, * means zero-or-more, + means one-or-more, [] builds a character class, () captures a group, and quantifiers, anchors and lookarounds stack on top. The gap between a pattern that works and one that almost works is frequently a single unescaped character — and the only reliable way to bridge that gap is testing against real input, which is exactly what this tool provides. The tester uses the same regex engine your browser's JavaScript uses, so results here match what your frontend code will produce — the same regex behaves identically in your application. That also means the tool supports modern JavaScript regex features: named capture groups (?<name>...), lookahead and lookbehind, non-greedy quantifiers, the unicode flag and more. Patterns port directly: test here, paste into your code, ship. Everything runs locally in your browser. Your patterns and test text are processed entirely by client-side JavaScript — nothing is uploaded, logged or stored on any server. Regexes routinely contain internal validation rules, proprietary ID formats and business logic you would rather keep on your device; you can test all of it with confidence, even offline once the page has loaded.
Frequently asked questions
How do I test a regular expression with this tool?+
Enter your pattern in the regex field (no surrounding slashes — the tool handles flags separately), paste or type your test text below it, and the matches appear live as you type. Each match is highlighted in context, and all capture groups are listed separately so you can see exactly what each parenthesis captured. Edit either side freely — the results re-run instantly on every change.
Why is my regex matching nothing?+
The most common culprits: case sensitivity (add a case-insensitive flag or match the exact case); anchors — ^ and $ force matches at the start or end of the string, silently excluding matches in the middle; unescaped special characters — a literal dot, asterisk or parenthesis must be escaped with a backslash; and character-class mistakes like [.] (matches only a literal dot) when you meant any character. Test against a short sample first, then scale up once the basics match.
Why is my regex matching too much (greedy matching)?+
Quantifiers are greedy by default: .* consumes as much as possible, which is why a pattern like <.*> swallows from the first bracket to the last instead of stopping at the first closing bracket. The fix is lazy quantifiers — add a question mark: <.*?> stops at the first match. This greedy-versus-lazy distinction is one of the most common regex surprises, and watching the highlighted matches change as you add the lazy modifier makes it click instantly.
What are capture groups and how do I use them?+
Parentheses in a pattern capture the text they enclose, letting you extract parts of a match — the domain from a URL, the year from a date, the value from a key-value pair. Groups are numbered from 1 in the order their parentheses open, and named groups like (?<year>\d{4}) give you readable labels instead of numbers. The tester lists every group separately for each match, so you can verify each captures exactly what you intended.
What do the regex flags mean (g, i, m, s, u)?+
Flags change how the whole pattern behaves: g makes the search find all matches instead of stopping at the first; i makes matching case-insensitive; m makes ^ and $ match at line boundaries instead of string boundaries; s lets the dot match newlines; u enables full Unicode handling — essential for emoji and non-Latin scripts; y (sticky) anchors matching to the previous match's end. Choose flags to match how your production code will run the pattern.
What does the error 'Invalid regular expression' mean?+
The pattern itself violates regex syntax: an unclosed group or bracket, a quantifier with nothing to repeat (a leading *), an invalid escape, or a malformed lookbehind. The error message names the position. Also note a special case: catastrophic backtracking patterns — like nested quantifiers (.*)* — will not error but will hang matching on long inputs; if the tester freezes on your pattern, that class of expression is why, and restructuring the pattern fixes it.
Are my regex patterns and test text uploaded anywhere?+
No. All matching runs locally inside your browser using client-side JavaScript — your patterns and test data never leave your device, are never transmitted to any server, and are never logged or stored. After the page loads you can disconnect from the internet and the tester keeps working. That makes it safe for internal validation rules, proprietary ID formats and any pattern logic you would rather keep on your own machine.
Do regexes tested here work the same in my backend or other languages?+
Mostly, with known differences at the edges. The tester uses JavaScript's regex engine, and the core syntax — character classes, quantifiers, groups, anchors — is shared across nearly all languages. Differences live in the features: lookbehind support varies by engine age, named-group syntax differs slightly in Python or PHP, and flags differ in names. The core you test here ports everywhere; verify engine-specific features against your target language's documentation.