developer

Regex Tester

Test regular expressions securely in your browser with live highlighting of all matches. Your regex and test data never leave your device.

/g/
Flags:
3 matches
Send results to alice@example.com and bob@test.org Contact: support@company.co.uk

Match details

#1alice@example.comindex 16
#2bob@test.orgindex 38
#3support@company.co.ukindex 60
Patterns saved locally
Pattern works? You can find differences in text blocks, or format code.Code Diff Checker

Test and debug regular expressions in real time with SolveBar's Regex Tester. Every match highlights instantly as you type, with detailed match information showing groups, indices and capture results. Build a personal library of saved patterns for reuse.

Understanding regex flags

The global flag (g) finds all matches instead of stopping at the first. Case-insensitive (i) matches upper and lowercase equally. Multiline (m) makes ^ and $ match line boundaries. The dotall flag (s) makes . match newline characters.

Capture groups and references

Parentheses create capture groups that extract specific parts of a match. For example, /([\w.]+)@([\w.]+)/ captures the username and domain of an email separately. Use $1, $2 in replace operations to reference groups.

Performance tips

Avoid catastrophic backtracking by not using nested quantifiers on overlapping patterns. Be specific rather than greedy — use [^,]+ instead of .+ to match content up to a comma. Test against edge cases including empty strings and very long inputs.

Frequently Asked Questions

Why is my regex not matching anything?

Check your flags — without the global flag (g) only the first match is found. Also verify you are not accidentally escaping characters that do not need escaping.

What does the dot (.) match in regex?

By default, dot matches any character except newline. Add the s (dotall) flag to make it match newlines too.

Can I use this to test email or URL validation patterns?

Yes. The library includes common patterns for email, URL, IP address, phone number, and more.