Test a regex pattern online
Paste a pattern and sample text to see every match and capture group highlighted — and figure out why a regex matches too much, too little, or nothing at all.
Open the tool, then paste the sample input below. Everything runs locally in your browser.
The problem
Regex is easy to get wrong: a greedy quantifier grabs too much, a missing anchor matches a substring, or an unescaped dot matches any character. Testing the pattern against real sample text shows exactly what it captures so you can fix it before shipping.
Sample input
(\d{4})-(\d{2})-(\d{2})
Released 2026-06-14 and patched 2026-07-01
Expected output
2026-06-14 groups: 2026 / 06 / 14
2026-07-01 groups: 2026 / 07 / 01
Two matches, each with three capture groups for year, month, and day. Anchoring with ^...$ would instead require the whole string to be a single date.
How to do it
- Enter the regular expression.
- Paste the sample text to test against.
- Set flags such as global or case-insensitive.
- Review the highlighted matches and capture groups.
- Refine the pattern until it matches what you expect.
Common mistakes
- A greedy quantifier like .* matching more than intended.
- Forgetting ^ and $ so a substring matches instead of the whole string.
- An unescaped dot matching any character rather than a literal period.
- Missing the global flag so only the first match is found.
- Different regex flavors — some features vary between engines.
Related tools
Related guides
FAQ
How do I test a regular expression?
Enter the pattern and some sample text. The tester highlights every match and shows the capture groups, so you can see exactly what the regex selects.
Why does my regex match too much?
Usually a greedy quantifier such as .* extends the match as far as possible. Use a lazy quantifier like .*? or a more specific character class to limit it.
Why does it match a substring instead of the whole value?
Without ^ and $ anchors a pattern can match anywhere in the text. Anchor the pattern to require the whole string to match.
What are capture groups?
Parentheses create capture groups that extract part of a match. In (\d{4})-(\d{2})-(\d{2}) the three groups capture the year, month, and day separately.
Is my text uploaded?
No. The regex runs locally in your browser. Your pattern and text are not sent to a server.
Regex testing runs locally in your browser. Nothing is uploaded.
Test patterns, diff text, format and query data, plus every other utility.