Regex Tester & Builder
Test, debug, and learn regular expressions with real-time matching, explanations, and common patterns.
Pattern Configuration
Define your regular expression pattern and options
//g
Find all matches
Case insensitive
^ and $ match line breaks
. matches newlines
Use $1, $2, etc. to reference capture groups in replacement
Test & Results
Enter test text and view matches in real-time
70 characters
Hello World! This is a test string with various words and numbers 123.
No matches found
Try adjusting your pattern or test string
Common Regex Patterns
Click any pattern to load it instantly with example text
Email Address
Validates email addresses with proper format
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
Example: user@example.com
Phone Number (US)
Matches US phone numbers in various formats
/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/
Example: (555) 123-4567
URL/Website
Matches HTTP/HTTPS URLs and websites
/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/
Example: https://www.example.com/path
IPv4 Address
Validates IPv4 addresses (0.0.0.0 to 255.255.255.255)
/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
Example: 192.168.1.1
Strong Password
At least 8 chars with upper, lower, number, special character
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
Example: MyPass123!
Credit Card
Matches major credit card number formats
/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$/
Example: 4111111111111111
Date (YYYY-MM-DD)
Validates ISO date format
/^\d{4}-\d{2}-\d{2}$/
Example: 2024-12-31
Time (24 Hour)
Validates 24-hour time format
/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/
Example: 14:30 or 09:15
Social Security
Matches US Social Security Number format
/^\d{3}-\d{2}-\d{4}$/
Example: 123-45-6789
Regex Reference Guide
Basic Metacharacters
.
Any character*
Zero or more+
One or more?
Zero or one^
Start of string$
End of string
Character Classes
\d
Any digit [0-9]\w
Word character\s
Whitespace[abc]
a, b, or c[a-z]
Lowercase range[^abc]
Not a, b, or c
Quantifiers
{3}
Exactly 3{3,}
3 or more{3,5}
Between 3-5*?
Lazy zero or more+?
Lazy one or more??
Lazy zero or one
Groups & Assertions
(abc)
Capture group(?:abc)
Non-capture\b
Word boundary(?=abc)
Positive lookahead(?!abc)
Negative lookaheada|b
a OR b