Regex Tester
Test regular expressions online with live matching highlights and capture groups. Type a pattern and a test string to see results instantly, with g/i/m/s/u flags and quick common-pattern chips. Everything runs locally in your browser.
How to use
- Type your expression in the "Regular expression" box without wrapping slashes, e.g. \d{4}-\d{2}-\d{2} for dates.
- Check the flags you need: g finds all matches, i ignores case, m makes ^ and $ match every line, s lets . match newlines, and u enables Unicode mode.
- Paste or type a test string below — every match is highlighted in real time, and an invalid pattern is reported instantly.
- "Match details" lists the full text of each match and its capture groups in order, so you can verify how your groups are extracted.
- For a quick start, click a "Common patterns" chip to fill common expressions such as email, URL, phone number or date into the input.
FAQ
Why do I get "invalid regular expression"?
Usually caused by an unclosed group or a misplaced quantifier, such as ([a-z]+ or a * or + with nothing before it. Make sure brackets are balanced and quantifiers follow a repeatable token; the browser message points near the problem.
What are capture groups used for?
Parts wrapped in parentheses are captured separately — for example (\d{4})-(\d{2}) captures the year and the month. This tool shows each group's value per match, which helps you debug data-extraction rules.
Why is only the first occurrence highlighted without g?
Without the g flag a regular expression matches only the first occurrence by default. Check "g global" to highlight every match in the text.
Is my text uploaded to a server?
No. Matching, highlighting and group inspection are all performed by local browser scripts, so the text you paste never leaves your device.