Regex Tester

Test regular expressions with live match highlighting

/ / g
Flags
Match Highlighting
Matches will be highlighted here...

Features

Real-Time Matching

See matches highlighted instantly as you type your pattern.

Find & Replace

Test replacements with capture group references ($1, $2).

Common Patterns

Pre-built patterns for email, URL, phone, IP, dates, and more.

Frequently Asked Questions

What regex flags are supported?

The tool supports four flags: g (global - find all matches), i (case insensitive), m (multiline - ^ and $ match line boundaries), and s (dotall - . matches newlines including \n).

How do I use capture groups?

Wrap parts of your pattern in parentheses, e.g., (\d+)-(\w+). Captured groups appear in the Match Details section as $1, $2, etc. In replace mode, use $1, $2 to reference captured groups.

Why isn't my regex matching anything?

Check these common issues: 1) Ensure the 'g' flag is enabled for multiple matches. 2) Special characters like . * + need escaping with \ if you want to match them literally. 3) Check the 'i' flag if case matters.

Can I use this for find and replace?

Yes! Click 'Show Replace' to enable replace mode. Enter a replacement string and see the result instantly. Use $1, $2, etc. to reference captured groups in the replacement.

Is my data sent to any server?

No. All regex matching happens entirely in your browser using JavaScript's built-in RegExp engine. Nothing is sent to any server.

What are the common patterns for?

The common patterns library includes pre-built regex for email, URL, phone numbers, IP addresses, dates, hex colors, HTML tags, and more. Click any pattern to load it instantly.