Skip to content

Regex Tester

Test and debug regular expressions in real-time

Regular Expression

//g

Test String

Hello world! My email is test@example.com and my website is https://example.com
0 found
Enter a pattern to start matching

Quick Reference

Character Classes

. - Any character \d - Digit [0-9] \w - Word char \s - Whitespace

Quantifiers

* - 0 or more + - 1 or more ? - 0 or 1 {n} - Exactly n

Anchors

^ - Start $ - End \b - Word boundary

Groups

(...) - Capture (?:...) - Non-capture (?=...) - Lookahead

Frequently asked questions

What do the regex flags mean?

'g' (global) finds all matches, not just first. 'i' ignores case. 'm' makes ^ and $ match line starts/ends. 's' makes . match newlines. Combine as needed: /pattern/gi.

Why isn't my regex matching?

Common issues: forgetting to escape special characters (., *, +, ?, etc.), not using 'g' flag for multiple matches, or forgetting that ^ and $ match string boundaries by default.

How do I capture groups in regex?

Use parentheses to capture: /(\d{3})-(\d{4})/ captures area code and number separately. Access with $1, $2 in replacements or match[1], match[2] in code.