Test regular expressions with real-time matching and pattern library
\b - Word boundary
+ - One or more of the preceding element
{n,m} - Between n and m repetitions
[...] - Character class (any one character inside brackets)
| - Alternation (OR)
. - Any character (except newline)
No matches found
Try adjusting your pattern or test string
Basic email validation pattern
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Example: user@example.com
RFC 5322 compliant email pattern
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
Example: user.name+tag@example.co.uk
Match HTTP and HTTPS URLs
https?://[\w\-]+(\.[\w\-]+)+[/#?]?.*
Example: https://www.example.com/path?query=value
Match URLs with various protocols
(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]
Example: ftp://files.example.com/document.pdf
US phone number (various formats)
\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}
Example: (555) 123-4567 or 555-123-4567
International phone number (E.164 format)
\+?[1-9]\d{1,14}
Example: +1234567890
US date format MM/DD/YYYY
(0[1-9]|1[0-2])/(0[1-9]|[12]\d|3[01])/(19|20)\d{2}
Example: 12/31/2024
ISO 8601 date format YYYY-MM-DD
\d{4}-\d{2}-\d{2}
Example: 2024-12-31
European date format DD/MM/YYYY
(0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/(19|20)\d{2}
Example: 31/12/2024
IPv4 address validation
\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b
Example: 192.168.1.1
IPv6 address (simplified)
(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Generic credit card format
\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}
Example: 4532-1234-5678-9012
Visa credit card (starts with 4)
4\d{3}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}
At least 8 characters with uppercase, lowercase, and number
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$
Example: Password123
Strong password with special characters
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Example: Pass@word123
Match HTML tags
<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)
Example: <div class="container">Content</div>
Match HTML comments
<!--[\s\S]*?-->
Example: <!-- This is a comment -->
Hex color code (#RGB or #RRGGBB)
#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})\b
Example: #FF5733 or #F57
RGB color format
rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)
Example: rgb(255, 87, 51)
Common image file extensions
\.(?:jpg|jpeg|png|gif|bmp|svg|webp)$
Example: photo.jpg
Common document file extensions
\.(?:pdf|doc|docx|txt|rtf|odt)$
Example: document.pdf
Username (3-16 alphanumeric, underscore, hyphen)
^[a-zA-Z0-9_-]{3,16}$
Example: user_name-123
URL-friendly slug (lowercase, hyphens)
^[a-z0-9]+(?:-[a-z0-9]+)*$
Example: my-blog-post-title
Positive or negative integer
^-?\d+$
Example: -42 or 123
Decimal number
^-?\d+\.\d+$
Example: -3.14 or 2.71
US currency format
\$\d{1,3}(?:,\d{3})*(?:\.\d{2})?
Example: $1,234.56
.
\d
\D
\w
\W
\s
\S
[abc]
[^abc]
[a-z]
*
+
?
{3}
{3,}
{3,5}
^
$
\b
\B
(abc)
(?:abc)
(?<name>abc)
\1
(?=abc)
(?!abc)
(?<=abc)
(?<!abc)
|
\
\n
\t
\r
All processing happens in your browser • Privacy-focused • No data sent to server