Regular Expression Matching Tool
Support regular expression matching tests, display match results, position information and line numbers, provide common regex templates and syntax reference.
Regular Expression
Flags:
/(empty)/gTest Text
Character Count:0Lines:1
Match Results
Enter regular expression and test text to automatically display match results
Common Regular Expressions
Email
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Match email address
Phone (China)
^1[3-9]\d{9}$Match 11-digit Chinese phone number
URL
^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$Match 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]?)$Match IPv4 address
Date (YYYY-MM-DD)
^\d{4}-\d{2}-\d{2}$Match date format
Number
\d+Match one or more digits
Integer
^-?\d+$Match integer (may include negative sign)
Chinese Character
[\u4e00-\u9fa5]Match a single Chinese character
Username (3-16 chars)
^[a-zA-Z0-9_]{3,16}$Match username (letters, numbers, underscore)
Version Number
^\d+(\.\d+){0,2}$Match version number (e.g.: 1.0.0)
Regex Syntax
Character Class
.Match any character except newline\dMatch digit [0-9]\DMatch non-digit\wMatch word character [a-zA-Z0-9_]\WMatch non-word character\sMatch whitespace character (space, tab, etc.)\SMatch non-whitespace characterQuantifier
*Match 0 or more times+Match 1 or more times?Match 0 or 1 time{n}Match exactly n times{n,}Match at least n times{n,m}Match n to m timesPosition
^Match string start (line start in multiline mode)$Match string end (line end in multiline mode)\bMatch word boundary\BMatch non-word boundaryGroup
()Capture group(?:)Non-capture group|OR operator[]Character set, match any one character[^]Negated character set