Regex Pattern Library
Browse and copy 41+ common regular expression patterns. Click Test to try a pattern inline.
Showing 41 of 41 patterns
Validates a standard email address format.
user@example.comMatches http or https URLs.
https://example.com/path?q=1Validates a dotted-decimal IPv4 address (0–255 per octet).
192.168.1.255Validates a full or compressed IPv6 address.
2001:0db8:85a3:0000:0000:8a2e:0370:7334Matches US phone numbers in common formats.
+1 (555) 867-5309E.164 international phone number format.
+447911123456Matches 5-digit US ZIP codes with optional +4 extension.
90210-1234Matches Canadian postal codes (e.g. A1B 2C3).
K1A 0B1Matches 16-digit card numbers with optional spaces or hyphens.
4111 1111 1111 1111Matches US Social Security Numbers in dashed format.
123-45-6789International Bank Account Number format.
GB82WEST12345698765432Matches dates in YYYY-MM-DD format.
2024-03-15Matches US-style dates with month and day validation.
03/15/2024Matches 24-hour time with optional seconds.
23:59:59Matches 12-hour time with AM/PM.
11:59 PMRequires uppercase, lowercase, digit, and special character; min 8 chars.
Passw0rd!Allows only letters and digits, no spaces or symbols.
abc123XYZAllows only alphabetic characters (a-z, A-Z).
HelloWorldAllows only numeric digits (0-9).
0123456789Matches HTML opening/closing tag pairs or self-closing tags.
<div class="foo">bar</div>Matches HTML comments including multiline.
<!-- This is a comment -->Matches 3 or 6 digit CSS hex color codes.
#ff6600Matches CSS rgb() color function with 0-999 values (use with range check).
rgb(255, 128, 0)Validates URL slugs: lowercase alphanumeric with single hyphens.
my-blog-postMatches UUIDs in standard 8-4-4-4-12 hex format.
550e8400-e29b-41d4-a716-446655440000Matches a 32-character hexadecimal MD5 hash.
d41d8cd98f00b204e9800998ecf8427eMatches a 64-character hexadecimal SHA-256 hash.
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855Matches Base64 encoded strings with optional padding.
SGVsbG8gV29ybGQ=Matches JSON Web Tokens (three base64url segments).
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIn0.abc123Matches semver strings with optional pre-release and build metadata.
1.2.3-beta.1+build.42Matches GitHub repository URLs.
https://github.com/user/my-repoMatches VISA card numbers (13 or 16 digits starting with 4).
4111111111111111Matches MasterCard numbers (16 digits, starting with 51-55).
5500005555555559Matches Amex 15-digit card numbers starting with 34 or 37.
371449635398431Generic 7-9 character alphanumeric US driver license number.
D1234567Matches strings that contain only whitespace characters.
Matches an empty string (zero characters).
Matches non-negative whole numbers (0, 1, 2, ...).
42Matches negative whole numbers (-1, -2, ...).
-7Matches positive or negative decimal numbers.
-3.14Matches numbers in scientific notation.
6.022e+23