Regex Pattern Generator

Ready-to-use regex patterns for common validation scenarios.

Email Address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Example: user@example.com
URL (HTTP/HTTPS)
^https?:\/\/[\w.-]+\.[a-zA-Z]{2,}.*$
Example: https://example.com
Phone (International)
^\+?[1-9]\d{1,14}$
Example: +1234567890
Phone (US Format)
^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$
Example: (555) 123-4567
IP Address (IPv4)
^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$
Example: 192.168.1.1
Credit Card
^\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}$
Example: 1234-5678-9012-3456
Date (YYYY-MM-DD)
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Example: 2024-01-15
Time (HH:MM)
^([01]\d|2[0-3]):[0-5]\d$
Example: 14:30
Hex Color
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
Example: #FF5733
Username
^[a-zA-Z0-9_]{3,16}$
Example: user_123
Password (Strong)
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Example: Pass@123
ZIP Code (US)
^\d{5}(-\d{4})?$
Example: 12345-6789
SSN
^\d{3}-\d{2}-\d{4}$
Example: 123-45-6789
Slug (URL-friendly)
^[a-z0-9]+(?:-[a-z0-9]+)*$
Example: my-blog-post

Ready-to-Use Regex Patterns

This collection provides tested regex patterns for common validation needs. Each pattern is designed to work in JavaScript and most regex engines. Click any pattern to test it, or copy directly to your code.

From email and URL validation to credit cards and passwords, these patterns save development time and help ensure consistent validation across your applications.

Email Validation

Email regex handles most valid addresses including subdomains and plus-addressing. Note that truly RFC-compliant email validation is extremely complex—this pattern covers practical use cases.

Password Strength

The strong password pattern enforces minimum 8 characters with uppercase, lowercase, digit, and special character requirements. Adjust the pattern based on your security policy.

Phone Number Formats

Phone patterns vary by region. The international format follows E.164 standard. US format allows common separators. Adjust patterns for your target regions.

Testing Your Patterns

Always test regex patterns with edge cases. Consider both valid inputs and invalid inputs that should be rejected. Use the built-in tester above to verify patterns work correctly.