Regex Generator - Pattern Library

Generate ready-to-use regular expression patterns for common tasks. Browse categories including email validation, phone numbers, URLs, IP addresses, and more. Copy tested regex patterns instantly for use in JavaScript, Python, Java, and other languages.

Email Address

Email

Match standard email format (RFC 5322 compatible)

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Flags: iExample: user@example.com

International Phone Number

Phone

Match international phone number with country code (E.164 format)

^\+?[1-9]\d{1,14}$
Flags: NoneExample: +8613812345678

URL

URL

Match HTTP/HTTPS URL format

^https?://[^\s/$.?#].[^\s]*$
Flags: iExample: https://www.example.com

Domain Name

URL

Match domain name format (with TLD validation)

^[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])?)*\.[a-zA-Z]{2,}$
Flags: iExample: www.example.com

IP Address (IPv4)

URL

Match IPv4 address format (0.0.0.0 - 255.255.255.255)

^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$
Flags: NoneExample: 192.168.1.1

Date (YYYY-MM-DD)

Date

Match ISO 8601 date format

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Flags: NoneExample: 2024-01-15

Time (HH:MM:SS)

Date

Match 24-hour time format

^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$
Flags: NoneExample: 14:30:00

Datetime (YYYY-MM-DD HH:MM:SS)

Date

Match ISO 8601 datetime format

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]) ([01]\d|2[0-3]):[0-5]\d:[0-5]\d$
Flags: NoneExample: 2024-01-15 14:30:00

Positive Integer

Number

Match positive integers

^[1-9]\d*$
Flags: NoneExample: 12345

Negative Integer

Number

Match negative integers

^-[1-9]\d*$
Flags: NoneExample: -12345

Integer (Signed)

Number

Match signed integers (positive and negative)

^-?[1-9]\d*$
Flags: NoneExample: -12345

Decimal Number

Number

Match decimal numbers (signed, with optional fractional part)

^-?\d+(\.\d+)?$
Flags: NoneExample: -123.456

Password (8+ chars, letters+digits)

Password

At least 8 characters, must include letters and numbers

^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$
Flags: NoneExample: Password123

Password (Strong)

Password

At least 8 chars, must include upper, lower, digit, and special char

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Flags: NoneExample: Pass@1234

Image File

File

Match common image file extensions

.*\.(jpg|jpeg|png|gif|bmp|webp|svg)$
Flags: iExample: photo.jpg

Video File

File

Match common video file extensions

.*\.(mp4|avi|mkv|mov|wmv|flv)$
Flags: iExample: video.mp4

Document File

File

Match common document file extensions

.*\.(pdf|doc|docx|xls|xlsx|ppt|pptx|txt)$
Flags: iExample: document.pdf

HTML Tag

HTML

Match HTML tags (opening and self-closing)

<[^>]+>
Flags: gExample: <div class="test">

HTML Attribute

HTML

Match HTML attribute name="value" pairs

\w+="[^"]*"
Flags: gExample: class="container"

Whitespace

Other

Match whitespace characters (spaces, tabs, newlines)

\s+
Flags: gExample:

Non-Whitespace

Other

Match non-whitespace characters

\S+
Flags: gExample: HelloWorld

Regex Pattern Concepts and Boundaries

Quick Start Guide

1

Choose a pattern category based on the input format you need to validate or extract

2

Read what the pattern matches, which flags it uses, and which example inputs pass

3

Compare the pattern against invalid or borderline samples before using it in code

4

Test and adapt the expression in Regex Tester when your production input rules differ

💡Pro Tips

Regex is best for format checks and text extraction, not for proving that an email address, URL, or account actually exists
Email and password patterns are policy choices: define allowed characters, length, and edge cases before picking a regex
Generated patterns use common syntax, but JavaScript, Python, Java, and database engines can differ on flags and lookarounds
For security-sensitive validation, combine regex with server-side rules, normalization, and business checks

Frequently Asked Questions

A regex generator provides reusable regular expression patterns for common validation and extraction tasks. It helps you start from a known pattern for email addresses, URLs, IP addresses, dates, or passwords, then review what the expression accepts, rejects, and cannot verify.
Regex can check string shape, not real-world truth. An email regex can detect a format, but it cannot prove that the mailbox exists. A URL regex can match a structure, but it cannot guarantee the page is reachable. Production validation should combine regex with business rules, normalization, and server-side checks.
The generator includes patterns for email validation, phone numbers, URL matching, IPv4 and IPv6 addresses, date formats, credit card numbers, postal codes, usernames, password policy checks, HTML tags, hex color codes, and other recurring text formats.
Use generated patterns as a starting point, then test them against your real valid, invalid, and borderline samples. Copy a pattern into Regex Tester, adjust it for your exact input rules, and confirm engine compatibility before relying on it in production code.

Still have questions? Check out our other tools or contact us for support.