Regex Library

Regex Patterns for Almost Anything

Search, copy, understand, and test practical regular expressions for email, phone numbers, URLs, dates, IP addresses, passwords, usernames, and more.

Free to use No signup Instant search Copy-ready patterns
Showing 115 matching patterns 100% Local Browser Search
Filter by Category All Categories

Popular & Essential Patterns

Frequently used
Email Popular

Email Address Format (Basic)

Checks basic email address shape ([email protected]). Does not verify domain existence, mailbox validity, or strict RFC compliance.

^[^\s@]+@[^\s@]+\.[^\s@]+$
e.g. [email protected] Matches
Phone Popular

US / Canada Phone Format (NANP)

Checks 10-digit North American Numbering Plan (NANP) phone format. Does not verify the number is assigned.

^(?:\+?1[-. ]?)?\(?([2-9][0-9]{2})\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$
e.g. (415) 555-2671 Matches
Phone Popular

Indian Mobile Number Format

Checks 10-digit Indian mobile format starting with 6, 7, 8, or 9. Does not verify the number is assigned.

^(?:\+91[\-\s]?)?[6-9]\d{9}$
e.g. +91 9876543210 Matches
URL Popular

Web URL Format (HTTP / HTTPS)

Matches web link format starting with http:// or https://.

^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
e.g. https://sarthakarsul.in/tools/ Matches
URL Popular

YouTube Video URL Format

Matches YouTube watch links, shorts, and shortened click links while capturing 11-char video ID.

^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})$
e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ Matches
IP Address Popular

IPv4 Address Format

Checks IPv4 format ensuring each octet is between 0 and 255.

^(?:(?: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]?)$
e.g. 192.168.1.254 Matches
IP Address Popular

IPv4 CIDR Subnet Block Format

Checks Classless Inter-Domain Routing (CIDR) subnet notation (/0 to /32).

^(?:(?: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]?)\/(?:3[0-2]|[12]?[0-9])$
e.g. 10.0.0.0/24 Matches
Date & Time Popular

ISO 8601 Date Format (YYYY-MM-DD)

Checks ISO 8601 date format (YYYY-MM-DD). Does not validate calendar semantics.

^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$
e.g. 2026-08-14 Matches
Password Popular

Password Format (4 classes, min 8)

Enforces minimum 8 characters with at least 1 uppercase, 1 lowercase, 1 number, and 1 special character.

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
e.g. P@ssw0rd2026! Matches
Username Popular

Standard Username Format

Checks standard user handle format containing 3 to 16 letters, numbers, or underscores.

^[a-zA-Z0-9_]{3,16}$
e.g. sarthak_arsul Matches
Postal & IDs Popular

Indian PIN Code Format

Checks 6-digit Indian Postal Index Number (PIN Code) format.

^[1-9][0-9]{5}$
e.g. 400001 Matches
HTML Popular

Hex Color Code Format (#FFF or #FFFFFF)

Checks 3-digit and 6-digit CSS hexadecimal color code format with optional # hash.

^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
e.g. #36d9d1 Matches
HTML Popular

Simple HTML Tag Extractor

Extracts opening and closing HTML tags along with inner content.

<([a-z1-6]+)(?:[^>]*>)(.*?)<\/\1>
e.g. <h1 class="title">Hello World</h1> Matches

All Regex Patterns

115 patterns total
Email Beginner

Email Address Format (Basic)

Checks basic email address shape ([email protected]). Does not verify domain existence, mailbox validity, or strict RFC compliance.

^[^\s@]+@[^\s@]+\.[^\s@]+$
e.g. [email protected] Matches
Email Intermediate

Email Address (RFC 5322 Subset)

Matches a subset of RFC 5322 email structure without IP domain literals.

^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$
e.g. [email protected] Matches
Email Beginner

Gmail Address Format

Matches basic Gmail address shape. Does not prove the Google account exists.

^[a-zA-Z0-9.]+@gmail\.com$
e.g. [email protected] Matches
Email Intermediate

Corporate Email Format (No Free Providers)

Checks email format while disallowing common free webmail providers.

^[a-zA-Z0-9._%+-]+@(?!gmail\.com|yahoo\.com|hotmail\.com|outlook\.com|icloud\.com)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
e.g. [email protected] Matches
Email Beginner

Email Format (Allows Subdomains)

Checks email format allowing multi-level subdomains.

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$
e.g. [email protected] Matches
Email Beginner

Email Format (No Plus Addressing)

Checks email format while disallowing plus-addressing (e.g., [email protected]).

^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
e.g. [email protected] Matches
Email Beginner

Email Username Extractor

Extracts the local username portion before the @ symbol in an email address.

^([^@]+)@
e.g. sarah_connor@ Matches
Email Beginner

Email Domain Extractor

Captures the domain name part following the @ symbol.

@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$
e.g. @sarthakarsul.in Matches
Email Intermediate

Email Format (Specific TLDs)

Checks email format ending with designated top-level domains.

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.(?:com|org|net|io|dev)$
e.g. [email protected] Matches
Email Intermediate

Obfuscated Email Finder

Matches emails written in human-obfuscated anti-spam text like 'user [at] domain [dot] com'.

\b[A-Za-z0-9._%+-]+(?:\s*\[at\]\s*|\s*@\s*)[A-Za-z0-9.-]+(?:\s*\[dot\]\s*|\s*\.\s*)[A-Za-z]{2,}\b
e.g. john [at] domain [dot] com Matches
Email Beginner

Clean Alphanumeric Email Format

Checks clean email formats without uncommon special characters.

^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$
e.g. [email protected] Matches
Phone Intermediate

US / Canada Phone Format (NANP)

Checks 10-digit North American Numbering Plan (NANP) phone format. Does not verify the number is assigned.

^(?:\+?1[-. ]?)?\(?([2-9][0-9]{2})\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$
e.g. (415) 555-2671 Matches
Phone Beginner

Indian Mobile Number Format

Checks 10-digit Indian mobile format starting with 6, 7, 8, or 9. Does not verify the number is assigned.

^(?:\+91[\-\s]?)?[6-9]\d{9}$
e.g. +91 9876543210 Matches
Phone Intermediate

Indian Landline Number Format

Checks Indian landline format with STD code prefix.

^0\d{2,4}[-\s]?\d{6,8}$
e.g. 022-25412345 Matches
Phone Beginner

International E.164 Phone Format

Checks ITU-T E.164 international standard format requiring plus sign and up to 15 digits.

^\+[1-9]\d{1,14}$
e.g. +442071838750 Matches
Phone Intermediate

UK Mobile Phone Format

Checks United Kingdom mobile phone format starting with 07 or +447.

^(?:\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$
e.g. +44 7911 123456 Matches
Phone Beginner

10-Digit Phone Format

Matches exact 10 numerical digits with no spaces or symbols.

^\d{10}$
e.g. 9876543210 Matches
Phone Intermediate

Phone Format with Extension

Checks phone numbers containing optional extensions like 'ext 123'.

^(?:\+?1[-. ]?)?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4}(?:\s*(?:ext|x|ext\.)\s*\d{1,5})?$
e.g. (800) 555-0199 ext 123 Matches
Phone Beginner

German Phone Format

Checks German telephone format starting with +49 or leading zero.

^(?:\+49|0)[\s.-]?[1-9](?:[\s.-]?\d){1,14}$
e.g. +49 30 123456 Matches
Phone Intermediate

Australian Phone Format

Checks Australian landline and mobile format (+61 / 0).

^(?:\+61|0)[\s.-]?[23478](?:[\s.-]?\d){8}$
e.g. +61 412 345 678 Matches
Phone Intermediate

French Phone Format

Checks French mobile and landline telephone format.

^(?:\+33|0)[\s.-]?[1-9](?:[\s.-]?\d{2}){4}$
e.g. +33 1 42 68 53 00 Matches
Phone Intermediate

US Toll-Free Phone Format

Checks 800, 888, 877, 866, 855, 844, and 833 toll-free area codes in North America.

^1?[-. ]?\(?(800|888|877|866|855|844|833)\)?[-. ]?\d{3}[-. ]?\d{4}$
e.g. 1-800-555-0199 Matches
URL Intermediate

Web URL Format (HTTP / HTTPS)

Matches web link format starting with http:// or https://.

^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
e.g. https://sarthakarsul.in/tools/ Matches
URL Intermediate

Strict HTTPS Only URL Format

Matches web URLs requiring encrypted HTTPS protocol.

^https:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
e.g. https://github.com/sarthakarsul Matches
URL Intermediate

Fully Qualified Domain Name (FQDN) Format

Checks hostname and TLD structure without protocol prefix.

^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$
e.g. sarthakarsul.in Matches
URL Beginner

URL Slug Format

Checks lowercase hyphen-separated permalink strings.

^[a-z0-9]+(?:-[a-z0-9]+)*$
e.g. how-to-compress-a-pdf Matches
URL Intermediate

YouTube Video URL Format

Matches YouTube watch links, shorts, and shortened click links while capturing 11-char video ID.

^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})$
e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ Matches
URL Beginner

GitHub Repository URL Format

Matches GitHub user/repository link format.

^https?:\/\/(?:www\.)?github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+\/?$
e.g. https://github.com/facebook/react Matches
URL Intermediate

IPv4 Address URL Format

Matches URLs formatted directly as valid IPv4 addresses with optional ports.

^https?:\/\/(?:(?: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]?)(?::\d{1,5})?(?:\/.*)?$
e.g. http://192.168.1.1:8080/dashboard Matches
URL Beginner

URL Query String Extractor

Extracts query parameters portion from full web URLs.

\?([^#\s]*)
e.g. ?category=developer&page=2 Matches
URL Beginner

URL Anchor / Hash Fragment Format

Matches target hash anchor identifiers at the end of URLs.

#[a-zA-Z0-9_-]+$
e.g. #section-features Matches
URL Beginner

FTP / SFTP Protocol URL Format

Matches File Transfer Protocol URL formats.

^(?:ftp|sftp):\/\/[^\s\/$.?#].[^\s]*$
e.g. sftp://files.example.com/upload Matches
URL Intermediate

Web Socket URL Format (WS / WSS)

Checks WebSocket connection URL format starting with ws:// or wss://.

^wss?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
e.g. wss://stream.example.com/socket Matches
IP Address Intermediate

IPv4 Address Format

Checks IPv4 format ensuring each octet is between 0 and 255.

^(?:(?: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]?)$
e.g. 192.168.1.254 Matches
IP Address Advanced

IPv4 CIDR Subnet Block Format

Checks Classless Inter-Domain Routing (CIDR) subnet notation (/0 to /32).

^(?:(?: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]?)\/(?:3[0-2]|[12]?[0-9])$
e.g. 10.0.0.0/24 Matches
IP Address Advanced

IPv6 Address Format (Common Forms)

Validates common 128-bit IPv6 address notations including zero compression (::).

^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$
e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334 Matches
IP Address Beginner

IPv6 Compressed Loopback Format

Matches exact IPv6 loopback interface ::1.

^::1$
e.g. ::1 Matches
IP Address Beginner

MAC Address Format

Checks 48-bit hardware MAC address format with colon or hyphen separators.

^(?:[0-9A-Fa-f]{2}[:-]){5}(?:[0-9A-Fa-f]{2})$
e.g. 00:1B:44:11:3A:B7 Matches
IP Address Intermediate

Port Number Format (1 - 65535)

Checks network port number format within legal range 1 to 65535.

^(?:6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3})$
e.g. 8080 Matches
IP Address Advanced

Private IPv4 Address Range Format

Matches private RFC 1918 IPv4 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).

^(?:10\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.(?:1[6-9]|2[0-9]|3[01])\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|192\.168\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$
e.g. 172.16.254.1 Matches
IP Address Intermediate

Loopback Address Format (127.0.0.1 / ::1)

Matches local host loopback interface formats.

^(?:127\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|::1)$
e.g. 127.0.0.1 Matches
IP Address Intermediate

Subnet Mask Format

Checks standard IPv4 network subnet mask format using valid octet boundaries.

^(255|254|252|248|240|224|192|128|0)\.(255|254|252|248|240|224|192|128|0)\.(255|254|252|248|240|224|192|128|0)\.(255|254|252|248|240|224|192|128|0)$
e.g. 255.255.255.0 Matches
IP Address Intermediate

Host:Port Pair Format

Checks hostname or valid IPv4 address coupled with a port number.

^(?:[a-zA-Z0-9.-]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)):(?:6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3})$
e.g. localhost:3000 Matches
Date & Time Beginner

ISO 8601 Date Format (YYYY-MM-DD)

Checks ISO 8601 date format (YYYY-MM-DD). Does not validate calendar semantics.

^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$
e.g. 2026-08-14 Matches
Date & Time Intermediate

ISO 8601 Full Timestamp Format

Checks ISO timestamp format with UTC indicator or timezone offset.

^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$
e.g. 2026-08-14T15:08:12Z Matches
Date & Time Beginner

Date Format (DD/MM/YYYY)

Checks European and Indian date format (DD/MM/YYYY).

^(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/\d{4}$
e.g. 14/08/2026 Matches
Date & Time Beginner

Date Format (MM/DD/YYYY)

Checks US date format (MM/DD/YYYY).

^(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12][0-9]|3[01])\/\d{4}$
e.g. 08/14/2026 Matches
Date & Time Beginner

12-Hour Time Format (HH:MM AM/PM)

Checks 12-hour clock time format with optional space before AM/PM.

^(?:0?[1-9]|1[0-2]):[0-5][0-9]\s?(?:AM|PM|am|pm)$
e.g. 03:08 PM Matches
Date & Time Beginner

24-Hour Time Format (HH:MM:SS)

Checks 24-hour clock time format with optional seconds.

^(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$
e.g. 15:08:12 Matches
Date & Time Intermediate

Date Format with Month Name

Matches dates written with abbreviated or full month names.

^(?:0?[1-9]|[12][0-9]|3[01])\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{4}$
e.g. 14 August 2026 Matches
Date & Time Advanced

Cron Schedule Expression Format (5 Fields)

Checks basic 5-field UNIX cron schedule structure (minute, hour, day, month, weekday).

^[*\d\/,\-]+\s+[*\d\/,\-]+\s+[*\d\/,\-]+\s+[*\d\/,\-]+\s+[*\d\/,\-]+$
e.g. 15 0 1 * * Matches
Date & Time Advanced

Leap Year Date Format (February 29th)

Matches February 29th specifically for leap years in the 1900s and 2000s.

^(?:(?:19|20)(?:[02468][048]|[13579][26])-02-29)$
e.g. 2024-02-29 Matches
Date & Time Beginner

Unix Timestamp Format (10 Digits)

Matches 10-digit Unix epoch timestamps (seconds).

^\d{10}$
e.g. 1786633692 Matches
Password Intermediate

Password Format (4 classes, min 8)

Enforces minimum 8 characters with at least 1 uppercase, 1 lowercase, 1 number, and 1 special character.

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
e.g. P@ssw0rd2026! Matches
Password Beginner

Password Format (Letters & Digits, min 8)

Requires minimum 8 characters combining letters and numbers.

^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$
e.g. SecretPass123 Matches
Password Advanced

Password Format (4 classes, min 12, no spaces)

Checks 12+ characters, all 4 character classes, and zero whitespace.

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9\s])\S{12,}$
e.g. K9#mQ2$pL8!vW Matches
Password Beginner

Numeric PIN Format (4 to 6 Digits)

Checks 4 to 6 digit security PIN format.

^\d{4,6}$
e.g. 492019 Matches
Password Beginner

No Whitespace String Format (8-64 Chars)

Checks format containing any non-whitespace characters between 8 and 64 characters.

^\S{8,64}$
e.g. my_secure_password_99 Matches
Password Intermediate

Restricted Character Set Password Format

Checks passwords containing only specific complex special symbols.

^[a-zA-Z0-9~!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?]{8,32}$
e.g. c0mpl3x#Code_! Matches
Password Beginner

Alphanumeric Password Format

Restricts format strictly to numbers and letters, prohibiting special characters.

^[a-zA-Z0-9]{8,30}$
e.g. alphaNumeric2026 Matches
Password Beginner

Long Passphrase Format (16-128 Chars)

Checks length-focused passphrases (16 to 128 characters).

^.{16,128}$
e.g. correct-horse-battery-staple Matches
Password Advanced

No Sequential Digits Format

Negative lookahead preventing sequential numeric strings like 123 or 876.

^(?!.*(?:012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210)).*$
e.g. pass8419#word Matches
Username Beginner

Standard Username Format

Checks standard user handle format containing 3 to 16 letters, numbers, or underscores.

^[a-zA-Z0-9_]{3,16}$
e.g. sarthak_arsul Matches
Username Beginner

Letter-First Username Format (3-20 Chars)

Checks username format starting with an alphabetic letter.

^[a-zA-Z][a-zA-Z0-9_]{2,19}$
e.g. devGuy99 Matches
Username Beginner

Hyphenated Username / User Slug Format

Checks lowercase usernames separated by hyphens (URL-safe).

^[a-z0-9]+(?:-[a-z0-9]+)*$
e.g. alex-developer Matches
Username Beginner

Twitter / X Handle Format

Matches Twitter/X handle format up to 15 characters with optional @ prefix.

^@?[a-zA-Z0-9_]{1,15}$
e.g. @sarthakarsul Matches
Username Intermediate

GitHub Username Format

Checks GitHub username guidelines: max 39 characters, single hyphens only, cannot start or end with a hyphen.

^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$
e.g. octocat Matches
Username Intermediate

Discord Username Format

Checks new Discord handles (2-32 chars) as well as legacy numeric discriminator tags (#1234).

^(?:[a-z0-9._]{2,32}|[a-zA-Z0-9_]{2,32}#\d{4})$
e.g. wumpus_dev Matches
Username Advanced

Instagram Username Format

Checks Instagram username format: 1-30 chars, no consecutive dots, cannot start/end with a dot.

^[a-zA-Z0-9._](?:(?!.*\.\.)[a-zA-Z0-9._.]*[a-zA-Z0-9_])?$
e.g. creative.coder Matches
Username Beginner

Telegram Username Format

Checks Telegram handle format (5 to 32 alphanumeric characters and underscores).

^[a-zA-Z0-9_]{5,32}$
e.g. telegram_dev Matches
Numbers Beginner

Integer Format (Positive & Negative)

Matches positive or negative whole number format.

^-?\d+$
e.g. -1042 Matches
Numbers Beginner

Positive Integer Only Format

Matches non-zero positive integers.

^[1-9]\d*$
e.g. 42 Matches
Numbers Beginner

Decimal Number Format (Float / Double)

Matches positive and negative floating point decimal number format.

^-?\d+(?:\.\d+)?$
e.g. -99.95 Matches
Numbers Intermediate

US Currency Format ($1,234.56)

Matches US dollar format with comma thousands separators and optional 2 decimal places.

^\$\d{1,3}(?:,\d{3})*(?:\.\d{2})?$
e.g. $1,250.50 Matches
Numbers Advanced

Indian Rupee Currency Format (₹1,50,000.00)

Matches Indian lakh and crore comma grouping currency format, or uncommaed values.

^\₹?\s?\d{1,2}(?:,\d{2})*,\d{3}(?:\.\d{2})?$|^\₹?\s?\d+(?:\.\d{2})?$
e.g. ₹1,50,000.00 Matches
Numbers Intermediate

Percentage Value Format (0% to 100%)

Checks percentage format between 0% and 100% with optional decimals.

^(?:100(?:\.0{1,2})?|\d{1,2}(?:\.\d{1,2})?)%$
e.g. 99.5% Matches
Numbers Intermediate

Scientific E-Notation Format

Checks scientific exponent notation format (e.g. 1.23e-10).

^-?\d+(?:\.\d+)?[eE][+-]?\d+$
e.g. 1.23e-10 Matches
Numbers Beginner

Hexadecimal Number Format (0x7FFF)

Matches hexadecimal numbers prefixed with 0x.

^0x[0-9a-fA-F]+$
e.g. 0x7FFF Matches
Numbers Advanced

Roman Numerals Format (I to MMMCMXCIX)

Matches Roman numeral representations up to 3999.

^M{0,3}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3})$
e.g. MMXXVI Matches
Numbers Advanced

Latitude & Longitude Coordinates Format

Checks geographic coordinate pairs format (e.g. 19.0760, 72.8777).

^[-+]?([1-8]?\d(?:\.\d+)?|90(?:\.0+)?),\s*[-+]?(180(?:\.0+)?|(?:1[0-7]\d|\d{1,2})(?:\.\d+)?)$
e.g. 19.0760, 72.8777 Matches
Postal & IDs Beginner

Indian PIN Code Format

Checks 6-digit Indian Postal Index Number (PIN Code) format.

^[1-9][0-9]{5}$
e.g. 400001 Matches
Postal & IDs Beginner

US ZIP Code Format (5 or 9 digits)

Checks standard US 5-digit ZIP codes and ZIP+4 formats.

^\d{5}(?:-\d{4})?$
e.g. 90210-1234 Matches
Postal & IDs Intermediate

UK Postcode Format

Checks UK postcode format (e.g. SW1A 1AA, EC1A 1BB).

^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$
e.g. SW1A 1AA Matches
Postal & IDs Intermediate

Canadian Postal Code Format

Checks Canadian alphanumeric postal code format in A1A 1A1 shape.

^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$
e.g. K1A 0B1 Matches
Postal & IDs Beginner

Australian Postcode Format

Checks Australian 4-digit postcode format.

^\d{4}$
e.g. 2000 Matches
Postal & IDs Advanced

Indian GSTIN Format

Checks 15-character Goods and Services Tax Identification Number (GSTIN) format in India.

^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$
e.g. 27AAPCU2050M1ZV Matches
Postal & IDs Beginner

Indian PAN Card Number Format

Checks 10-character Permanent Account Number (PAN) format in India.

^[A-Z]{5}\d{4}[A-Z]{1}$
e.g. ABCDE1234F Matches
Postal & IDs Beginner

German Postal Code Format (PLZ)

Checks German 5-digit Postleitzahl (PLZ) format.

^\d{5}$
e.g. 10115 Matches
Postal & IDs Intermediate

Indian Aadhaar Number Format

Checks 12-digit Indian Aadhaar identification number format.

^[2-9]\d{3}\s?\d{4}\s?\d{4}$
e.g. 9876 5432 1098 Matches
Postal & IDs Advanced

US Social Security Number (SSN) Format

Checks US 9-digit Social Security Number format in XXX-XX-XXXX shape.

^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$
e.g. 123-45-6789 Matches
HTML Beginner

Hex Color Code Format (#FFF or #FFFFFF)

Checks 3-digit and 6-digit CSS hexadecimal color code format with optional # hash.

^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
e.g. #36d9d1 Matches
HTML Intermediate

Simple HTML Tag Extractor

Extracts opening and closing HTML tags along with inner content.

<([a-z1-6]+)(?:[^>]*>)(.*?)<\/\1>
e.g. <h1 class="title">Hello World</h1> Matches
HTML Beginner

Self-Closing HTML Tag Format

Matches self-closing HTML tags like <img /> or <br />.

<[a-z1-6]+[^>]*\/>
e.g. <img src="image.jpg" alt="pic" /> Matches
HTML Beginner

HTML Comment Extractor

Extracts multi-line HTML comment blocks <!-- ... -->.

<!--[\s\S]*?-->
e.g. <!-- TODO: fix spacing --> Matches
HTML Intermediate

RGB / RGBA Color Function Format

Checks CSS rgb() and rgba() color expression format.

^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$
e.g. rgba(255, 111, 169, 0.5) Matches
HTML Beginner

CSS Class Selector Format

Checks CSS class name selector format starting with a period.

^\.[a-zA-Z_][a-zA-Z0-9_-]*$
e.g. .btn-primary-glow Matches
HTML Beginner

Markdown Heading Format (# H1)

Matches Markdown header lines (# Heading).

^(#{1,6})\s+(.+)$
e.g. ## Section Title Matches
Social Media Beginner

LinkedIn Profile URL Format

Checks public LinkedIn user profile URL format.

^https?:\/\/(?:www\.)?linkedin\.com\/in\/[a-zA-Z0-9_-]+\/?$
e.g. https://www.linkedin.com/in/sarthakarsul Matches
Social Media Beginner

Facebook Profile / Page URL Format

Checks Facebook user profiles and page URL format.

^https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/?$
e.g. https://facebook.com/zuck Matches
Social Media Beginner

Hashtag Matcher Format

Matches social media hashtag format starting with #.

#[a-zA-Z0-9_]+\b
e.g. #WebDevelopment Matches
Social Media Beginner

Twitch Channel URL Format

Checks Twitch channel URL format.

^https?:\/\/(?:www\.)?twitch\.tv\/[a-zA-Z0-9_]{4,25}\/?$
e.g. https://twitch.tv/shroud Matches
Social Media Beginner

Reddit User Handle Format (u/username)

Checks Reddit u/username handle format.

^(?:u\/)?[a-zA-Z0-9_-]{3,20}$
e.g. u/code_wizard Matches
Files Beginner

File Extension Matcher (Common Types)

Matches common document and image file extensions at the end of filenames.

\.(?:jpg|jpeg|png|gif|svg|pdf|docx?|xlsx?)$
e.g. document.pdf Matches
Files Beginner

Image File Extensions Only Format

Checks image file formats (.png, .jpg, .jpeg, .gif, .webp, .svg).

\.(?:png|jpe?g|gif|webp|svg|bmp|ico)$
e.g. avatar.webp Matches
Files Beginner

PDF File Name Only Format

Checks filenames ending strictly with .pdf extension.

^[a-zA-Z0-9_-]+\.pdf$
e.g. quarterly_report.pdf Matches
Files Intermediate

UUID / GUID Version 4 Format

Checks 128-bit RFC 4122 Version-4 Universally Unique Identifier 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}$
e.g. c892a58a-487b-4954-a0f3-5d1b5042dcdc Matches
Files Intermediate

Base64 Encoded String Format

Checks Base64 padded payload string format.

^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
e.g. SGVsbG8gV29ybGQ= Matches
Files Intermediate

JWT (JSON Web Token) Structure Format

Checks 3-part dot-separated JSON Web Token structure (Header.Payload.Signature).

^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$
e.g. eyJhbGciOiJIUzI1NiJ9.payload.signature Matches
Files Advanced

Semantic Versioning (SemVer) Format

Checks SemVer 2.0.0 version number format (MAJOR.MINOR.PATCH-prerelease).

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
e.g. 2.1.0-alpha.1 Matches
Programming Beginner

Programming Identifier / Variable Format

Checks standard variable name format in C, C++, Java, Python, and JavaScript.

^[a-zA-Z_][a-zA-Z0-9_]*$
e.g. user_score_val Matches
Programming Beginner

Single-Line Comment Format (// or #)

Matches single line code comment format starting with // or #.

^(?:\/\/|#)\s*(.*)$
e.g. // TODO: refactor engine Matches
Programming Beginner

Basic SQL SELECT Syntax

Matches basic SQL SELECT ... FROM query structure.

^SELECT\s+.+\s+FROM\s+.+$
e.g. SELECT id, name FROM users Matches
Programming Intermediate

Simple JSON Key-Value Fragment Format

Matches key-value assignment fragment in JSON strings.

\"[a-zA-Z0-9_]+\":\s*(?:\"[^\"]*\"|\d+|true|false|null)
e.g. "status": "success" Matches
Programming Beginner

Git SHA-1 Commit Hash Format

Matches 40-character SHA-1 hexadecimal Git commit hash format.

^[0-9a-fA-F]{40}$
e.g. e3b0c44298fc1c149afbf4c8996fb92427ae41e4 Matches
Programming Intermediate

JavaScript Function Declaration Syntax

Matches standard JavaScript function declaration syntax.

^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(([^)]*)\)
e.g. function calculateTotal(items) Matches

Comprehensive Regular Expressions Reference & Pattern Collection

Regular expressions (regex) are standard syntax sequences for string pattern matching, data extraction, and input validation. Whether you need an email regex for form verification, a phone number regex for regional formatting, a URL regex for web scrapers, or an IP address regex for network security, this Regex Library provides production-tested, copy-ready patterns with full syntax breakdowns. All search and filtering operations run 100% client-side inside your web browser.

Quick Reference

Understand Regex Basics

A quick cheat sheet of common regular expression tokens, quantifiers, and character classes.

^ Start of string / line
$ End of string / line
. Any single character
* Zero or more matches
+ One or more matches
? Optional (0 or 1 match)
[a-z] Character class range
(...) Capture group
| Alternation (OR operator)
\d Any digit (0-9)
\w Word char (a-z, 0-9, _)
\s Whitespace character
Need to test your own pattern with live flags? Need to test your own pattern? Open Regex Tester

Have Your Own Custom Regex?

Test it instantly against real text, debug capture groups, and generate integration code using our interactive Regex Tester.

Open Regex Tester
Regex copied to clipboard.