Regex Tester
Test and debug regular expressions in real-time
Regular Expression
Test String
Quick Reference
Character Classes
. - Any character
\d - Digit [0-9]
\w - Word char
\s - WhitespaceQuantifiers
* - 0 or more
+ - 1 or more
? - 0 or 1
{n} - Exactly nAnchors
^ - Start
$ - End
\b - Word boundaryGroups
(...) - Capture
(?:...) - Non-capture
(?=...) - LookaheadFrequently 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.