Test regular expressions with live match highlighting and group capture.
This tool runs 100% in your browser. All computation happens locally on your device — your input is never uploaded to any server. Results are for reference only.
A regular expression is a tiny state machine: the engine starts at the left, tries to match the pattern, and on success records a match then resumes just after it. Flags change the walk — g keeps scanning, i relaxes case, m re-anchors ^/$ to each line. Capturing groups (…) store sub-parts so you can pull out just the fraction of each hit.
Pattern /\d+/g against the string 'A1B22C333': the engine finds 1, resumes after it, finds 22, resumes, finds 333. Without the /g flag it stops after the first hit.
Same sandwich description, three extraction goals.
Test regular expressions with match highlighting, capture group display, and all standard flags (g, i, m, s, u, y). 100% in-browser, free.
This tester is a live workbench for regular expressions: type a pattern and sample text, and every match highlights in place as you type. Beyond matching, it exposes the machinery developers actually need to debug patterns — numbered capture groups with their extracted values, all standard flags including global, case-insensitive, multiline, and dotall, and clear errors when the pattern fails to compile. Named groups render with their labels, and match counts update live, so you can tighten a pattern against real data instead of guessing whether it works.
Developers building validation rules for forms and APIs confirm a pattern accepts every valid input and rejects the invalid before shipping it. Data engineers writing extraction patterns for logs and text pull the capture groups they named straight from the panel. Anyone maintaining legacy regex — often the most feared code in a repository — pastes it here with representative input to understand what it actually matches before touching it. QA engineers construct boundary-case strings that expose greedy-versus-lazy and anchor mistakes before production does.
(1) Enter your pattern; compile errors show immediately with position hints. (2) Toggle flags — g for all matches, i for case-insensitivity, m for ^ and $ per line, s so dot matches newlines, plus u and y. (3) Paste sample text into the subject area; matches highlight live and the count updates. (4) Inspect results: each match with its index, and every capture group — numbered and named — with extracted text and a quick null check for optional groups that did not participate. Patterns and text stay local to your browser.
Five patterns of failure account for most regex bugs. Greedy quantifiers swallowing too much: .* in <.*> consumes to the last > on the line — switch to lazy .*? or use negated classes like [^>]*. Unescaped special characters: a literal dot must be \. or it matches any character, the classic email-validation leak. Missing anchors: ^\d{4} without ^ matches the last four digits anywhere — decide whether substring matching is intended. Catastrophic backtracking: nested quantifiers like (a+)+ against long non-matching input hang engines — unroll the pattern or add atomic-style possessive behavior where supported. And platform drift: lookbehind, named groups, and Unicode property escapes vary across engines, so test against the flavor you ship to. This tester runs the JavaScript flavor, which matches browser and Node environments exactly.
It uses the JavaScript RegExp engine with all standard flags: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode), and y (sticky). Live match highlighting shows all matches simultaneously. Capture groups are displayed in a numbered list below the match results for easy debugging.
Yes. Enable the m flag for multiline mode (^ and $ match line boundaries) or the s flag for dotall mode (. matches newlines). This is essential for parsing log files, extracting data from structured text, and validating multiline form input. All processing is 100% in-browser.
What do you call a crab that plays baseball?
No paywalls, no signups, no data sold. Built by a solo developer who believes useful tools should be accessible to everyone.
☕Support me on Ko-fi— keep tools free100% of proceeds go towards hosting & building more free tools.