MultiTools Logo
MultiTools
GitHub

Regex Pattern Library

Collection of common, tested regular expression patterns for validation and matching.

Email & Communication
Email Address
Matches standard email addresses
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Example: user@example.com

Email & Communication
Simple Email
Basic email validation (less strict)
\S+@\S+\.\S+

Example: test@domain.org

URLs & Web
URL
Matches HTTP/HTTPS URLs
https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)

Example: https://www.example.com/path

URLs & Web
Domain Name
Valid domain names
^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$

Example: example.com

Phone Numbers
US Phone Number
US phone numbers with various formats
^(\+1[-\s]?)?\(?([0-9]{3})\)?[-\s]?([0-9]{3})[-\s]?([0-9]{4})$

Example: (555) 123-4567

Phone Numbers
International Phone
International phone format (E.164)
^\+[1-9]\d{1,14}$

Example: +1234567890

Numbers & Currency
Integer
Positive or negative whole numbers
^-?\d+$

Example: -123, 456

Numbers & Currency
Decimal Number
Decimal numbers (floats)
^-?\d*\.?\d+$

Example: 3.14159, -0.5

Numbers & Currency
Currency
Currency amounts with optional commas
^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(\.[0-9][0-9])?$

Example: $1,234.56

Dates & Time
US Date (MM/DD/YYYY)
US date format validation
^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d\d$

Example: 12/25/2023

Dates & Time
ISO Date (YYYY-MM-DD)
ISO 8601 date format
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$

Example: 2023-12-25

Dates & Time
24-Hour Time
24-hour time format
^([01]?[0-9]|2[0-3]):[0-5][0-9]$

Example: 14:30

Network
IPv4 Address
Valid IPv4 addresses
^(?:(?: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]?)$

Example: 192.168.1.1

Network
IPv6 Address
Valid IPv6 addresses (simplified)
^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|...)$

Example: 2001:0db8:85a3::8a2e:0370:7334

Financial
Credit Card
Major credit card formats
^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$

Example: 4532015112830366

Security
Strong Password
Min 8 chars, upper, lower, number, special
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

Example: MyP@ssw0rd

User Data
Username
Alphanumeric, 3-16 chars
^[a-zA-Z0-9_-]{3,16}$

Example: john_doe123

User Data
URL Slug
SEO-friendly URL slugs
^[a-z0-9]+(?:-[a-z0-9]+)*$

Example: my-blog-post

Colors
Hex Color
Hex color codes
^#(?:[0-9a-fA-F]{3}){1,2}$

Example: #FF5733, #FFF

Colors
RGB Color
RGB color format
^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$

Example: rgb(255, 87, 51)

File Paths
Filename
Valid filenames with extension
^[^\<>":/\\|?*\x00-\x1f]+\.[a-zA-Z0-9]{1,6}$

Example: document.pdf

File Paths
File Path
Windows/Unix file paths
^(?:[a-zA-Z]:)?\\?(?:[^\\<>":|?*\x00-\x1f]+\\?)*[^\\<>":|?*\x00-\x1f]+$

Example: /home/user/file.txt

Social Media
Twitter/X Handle
Twitter/X username
^@?[a-zA-Z0-9_]{1,15}$

Example: @username

Social Media
Hashtag
Social media hashtags
^#?[a-zA-Z0-9_]+$

Example: #javascript

IDs
UUID v4
UUID version 4 format
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$

Example: 550e8400-e29b-41d4-a716-446655440000

Code
HTML Tag
Matches HTML tags
<\/?[\w\s="'&:;#]+\/?>

Example: <div class='test'>

Code
CSS Class
CSS class selectors
\.[a-zA-Z_-][a-zA-Z0-9_-]*

Example: .my-class

How to Use

Click the copy button on any pattern to copy it to your clipboard. These patterns can be used in:

JavaScript

const regex = /pattern/;
regex.test(string);

Python

import re
re.match(r'pattern', string)

Command Palette

Search for a command to run...