What this Regex Tester does
This English-language regex tester runs entirely in your browser — your patterns and test strings never leave your device. No uploads, no tracking, no server logs. Paste a regular expression, type your input, and every match lights up in place as you type. Capture groups — both numbered and named — appear alongside their values and character positions, so you can see exactly what your pattern captured without printing to a console. Invalid patterns show a friendly error message instead of silently failing. One-click flag toggles let you flip g, i, m, s, u, and y and watch the result change immediately. A zero-width-match safety guard prevents patterns like ^ or empty-string lookarounds from locking up the page. Whether you're doing regular expression testing against a log snippet or refining a validator before shipping it, you get immediate feedback without leaving the browser tab.
Features
- Live in-place highlighting. Every match is highlighted directly inside the input string as you type, so you can see the full match extent without scanning a separate list.
- Full capture-group inspection. Numbered groups (
$1,$2, …) and named groups ((?<year>\d{4})) are listed with their exact values and start/end positions after each run. - One-click flag toggling. Toggle the global (
g), case-insensitive (i), multiline (m), dotAll (s), Unicode (u), and sticky (y) flags individually and see match counts update instantly. - Friendly error messages. Invalid syntax — an unclosed group, a bad escape sequence, or an unsupported feature — surfaces a plain-English explanation rather than a raw engine error.
- Zero-width-match safety guard. Patterns that can produce zero-width matches (anchors, lookarounds, empty alternations) are detected and stepped safely so the page never freezes in an infinite loop.
- Privacy-first by design. The tool runs entirely in the browser using the native JavaScript regex engine. Nothing is sent to a server — making it safe for sensitive log lines or proprietary patterns. As noted in the Unicode TR #29 (text segmentation) spec, text boundaries matter; this tester respects Unicode semantics when the
uflag is active.
How to use the Regex Tester
Type or paste your regex and your test string, toggle any flags you need, and matches appear immediately.
- Enter your pattern. Type the regular expression in the pattern field — without surrounding slashes. For example,
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})to match ISO dates. - Paste your test string. Paste the text you want to test — a log line, a CSV row, a block of code. The tester highlights all matches in place.
- Toggle flags as needed. Click
gto find all matches instead of just the first,ito make the match case-insensitive, ormto treat each newline as a new start/end anchor. - Inspect capture groups. Scroll the results panel to see each group's value and position. Named groups like
(?<month>\d{2})appear by name, making it easy to map captures to your parser fields. - Copy your pattern. Hit Copy to grab the validated pattern and paste it directly into your JavaScript, Python, or Java project. If you also need to normalize the matched text's casing, the [case converter](/en/case-converter/) handles that in one step.
Common use cases
- Validate user input before shipping. Test an email, URL, or phone-number regex against real-world samples — including edge cases like Seattle area codes or New York ZIP+4 formats — before it ever reaches production.
- Debug log parsing on the fly. Paste a raw server log line and refine your pattern until every field — timestamp, HTTP method, status code — lands in its own capture group, ready for a structured parser.
- Compare flag combinations instantly. Toggle
gon and off to see how many matches change, or addito confirm case-insensitive matching covers all variants. Immediate feedback beats a trial-and-error deploy cycle. - Build and test named groups. Wire up
(?<token>[A-Za-z0-9_]+)and verify the named group returns the right value before integrating it into a lexer or template engine. If you need to compare two text versions after extraction, the [text diff](/en/text-diff/) tool pairs well here. - Learn regex interactively. Step through quantifiers, anchors, and lookarounds one at a time — the live feedback loop makes it easy to understand why
.*grabs too much and.*?is the fix.
Frequently asked questions
Does this regex tester send my patterns or test strings to a server?
No. The tool is 100% client-side — your patterns and test strings never leave your browser. There are no uploads, no server logs, and no tracking. It's safe to paste sensitive log data or proprietary patterns.
Which regex flavor does this tester use?
It uses the JavaScript (ECMAScript) regex engine built into your browser. JavaScript regex supports most common features — character classes, quantifiers, lookaheads, lookbehinds (ES2018+), and named capture groups — but does not support some PCRE-only features like recursive patterns or \K. If you're targeting a Java or Python regex, the syntax is mostly compatible for common patterns, but always verify engine-specific behavior.
Why does adding the `g` flag change how capture groups behave?
Without g, the engine returns the first match plus all its capture groups. With g, it finds all matches but in some contexts (like String.prototype.match) does not return capture groups for each — you'd use matchAll instead. This tester always shows capture groups per match regardless of the g flag, so you can inspect every hit.
What are named capture groups and when should I use them?
Named capture groups use the syntax (?<name>pattern) and let you reference a match by a readable label rather than a positional index. They're especially useful in parsers and template engines — result.groups.year is clearer than result[1]. This tester lists both numbered and named groups in the results panel. Named groups are part of the ECMAScript 2018 spec and are widely supported in modern browsers and Node.js.
My pattern 'should work' but matches nothing — what do I check first?
Three common culprits: (1) a missing g flag when you expect multiple matches, (2) unescaped special characters — a literal dot needs \. not ., (3) the regex flavor differs from what you tested elsewhere. Greedy quantifiers like .* can also swallow more than expected; try switching to .*? for non-greedy matching. The Unicode TR #29 (text segmentation) spec is a good reference if your pattern involves word boundaries across non-ASCII text.
Can I use this as a regex calculator or regex generator for simple patterns?
The tester validates and explains any pattern you write, which makes it useful as a regex checker and online regex tool for building patterns incrementally. Type a fragment, confirm it matches, then extend it — this iterative approach is more reliable than generating a complete pattern from scratch and hoping it works.