Regex Tester
Test and debug regular expressions, see real-time matches, support flags and common patterns.
Regular Expression
Enter the regex to test
Current Flags:
//g
Test String
Enter text to match against
Common Patterns
Click to use preset regular expressions
Email Address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Matches valid email address format
Phone Number (China)
^1[3-9]\d{9}$
Matches Mainland China phone numbers
URL
^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$
Matches HTTP/HTTPS URL
IP Address
^(?:(?: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]?)$
Matches IPv4 address
Password Strength
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d@$!%*?&]{8,}$
At least 8 chars, containing uppercase, lowercase, and digit
ID Card (China)
^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$
Matches 18-digit Chinese ID card number
Quick Reference
.Any character\\dDigit [0-9]\\wWord char [a-zA-Z0-9_]\\sWhitespace^Start of string$End of string