Complete Pattern Library
Email Address
Validates a standard email address format.
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/✓ Matches
user@example.comjohn.doe+test@sub.domain.org✗ Non-matches
user@.com@missing-user.comuser@examplejavascript
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
regex.test('user@example.com');URL Validation
Validates a web URL including http/https protocols.
/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/✓ Matches
https://www.example.comhttp://sub.example.co.uk/path?q=1✗ Non-matches
www.example.comhttps://htp://example.comjavascript
const regex = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/;
regex.test('https://example.com');Strong Password
Requires at least 8 characters, one uppercase, one lowercase, one number, and one special character.
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/✓ Matches
StrongP@ss1P4ssw0rd!✗ Non-matches
weakpassOnlyUpper1NoSpecialChar1javascript
const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
regex.test('StrongP@ss1');IPv4 Address
Matches a valid IPv4 address (0-255 blocks).
/^(?:(?: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
192.168.1.1255.255.255.0✗ Non-matches
256.1.1.1192.168.1192.168.1.1.1javascript
const regex = /^(?:(?: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]?)$/;
regex.test('192.168.1.1');Hex Color Code
Matches 3 or 6 digit hex color codes.
/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/✓ Matches
#FFF#000000#a3f✗ Non-matches
#ZZZ#1234123456javascript
const regex = /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
regex.test('#FFFFFF');ISO Date (YYYY-MM-DD)
Matches dates in YYYY-MM-DD format (basic validation).
/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/✓ Matches
2023-12-251999-01-01✗ Non-matches
2023-13-0123-01-012023/12/25javascript
const regex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/;
regex.test('2023-12-25');Extract HTML Tags
Matches HTML tags and their attributes.
/<\/?([a-zA-Z0-9]+)(?:\s+[^>]+)?>/g✓ Matches
<div class="test"></div><img>✗ Non-matches
1 < 2Not a tagjavascript
const regex = /<\/?([a-zA-Z0-9]+)(?:\s+[^>]+)?>/g;
const str = '<div>test</div>';
const tags = str.match(regex);Trim Whitespace
Matches leading and trailing whitespace to trim it.
/^\s+|\s+$/g✓ Matches
test \twordend\n✗ Non-matches
no-whitespacemiddle whitespacejavascript
const regex = /^\s+|\s+$/g;
' test '.replace(regex, '');