Regex Tester
Free online regex tester: live match highlighting, capture groups, replace preview and g/i/m flags — all running locally in your browser.
How to Use
- Enter the pattern and flags
Type your rule in the pattern box (without slashes) and pick g / gi / gm / i / m as needed.
- Paste the test text
Put the content you want to validate or extract into the text area; matches are highlighted live with the match count and first match.
- Preview the replacement
Fill in the replacement field ($1 backreferences work) to see the replaced text instantly, then copy it with one click.
FAQ
Why do I only get one match?
The g (global) flag is not set. Without g, a regex returns only the first match — pick 'g global' or 'gi'/'gm' to list every match.
How do I read capture groups?
Anything wrapped in parentheses is a capture group. For example (\d{4})-(\d{2}) captures the year and month, and the match details panel lists each group value in order.
Do $1 and $2 work in the replacement?
Yes. The replacement field supports backreferences, so replacing (\d{4})-(\d{2}) with $1/$2 turns 2026-10 into 2026/10.
What happens if my pattern is invalid?
The browser throws a syntax error, which the tool shows as a message below the results. The page keeps working and recomputes as soon as you fix the pattern.