Test and debug regular expressions with live matching, explanations, and common pattern examples. Perfect for developers working with text processing and validation.
Regular Expression
//
Test String
Common Patterns
Email Address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Match valid email addresses
Phone Number (US)
^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$
Match US phone numbers
URL
https?://[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(/[^\s]*)?
Match HTTP/HTTPS URLs
IP Address
\b(?:\d{1,3}\.){3}\d{1,3}\b
Match IPv4 addresses
Hex Color
#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\b
Match hexadecimal color codes
Date (YYYY-MM-DD)
\d{4}-\d{2}-\d{2}
Match ISO date format
Username
^[a-zA-Z0-9_]{3,16}$
Match valid usernames (3-16 chars)
Credit Card
\d{4}[-.\s]?\d{4}[-.\s]?\d{4}[-.\s]?\d{4}
Match credit card numbers
RegEx Quick Reference
Character Classes
- . - Any character
- \d - Digit (0-9)
- \w - Word character
- \s - Whitespace
- [abc] - a, b, or c
- [^abc] - Not a, b, or c
- [a-z] - Range a to z
Quantifiers
- * - 0 or more
- + - 1 or more
- ? - 0 or 1
- {3} - Exactly 3
- {3,} - 3 or more
- {3,5} - 3 to 5
Anchors
- ^ - Start of string
- $ - End of string
- \b - Word boundary
- \B - Not word boundary
Groups
- (abc) - Capture group
- (?:abc) - Non-capturing
- \1 - Backreference
Alternation
- a|b - a or b
- (a|b) - Group a or b
Lookaround
- (?=abc) - Positive lookahead
- (?!abc) - Negative lookahead
For more developer tools, visit texttoolbox.io.