Regular Expression Memo

Collection of commonly used regular expression patterns with examples and explanations

Integer Numbers

Matches whole numbers, including negative numbers

Numbers

Examples

123 -456 0

Decimal Numbers

Matches decimal numbers with optional negative sign

Numbers

Examples

123.45 -456.789 0.1

Currency

Matches currency format with optional thousands separators

Numbers

Examples

$123.45 $1,234.56 $1,000

Alphanumeric

Matches letters and numbers only

Strings

Examples

abc123 ABC789 Dev2024

Username

Matches usernames starting with a letter, followed by letters, numbers, underscores or hyphens

Strings

Examples

john_doe user123 dev-2024

ISO Date

Matches dates in YYYY-MM-DD format

Dates

Examples

2025-01-13 2025-01-20 2025-02-13

24-Hour Time

Matches time in 24-hour format (HH:MM)

Dates

Examples

11:55 08:30 23:59

Basic Email

Matches most common email address formats

Emails

Examples

support@towalles.com info@example.com

Strict Email

Matches email addresses with stricter domain validation

Emails

Examples

admin@towalles.com contact@sub.example.com

Basic URL

Matches HTTP and HTTPS URLs

URLs

Examples

https://towalles.com https://towalles.com/en/development/regex-tester

Strict URL

Matches URLs with strict domain and path validation

URLs

Examples

https://towalles.com/en/development/regex-memo https://towalles.com/en/development/yaml-formatter

International Phone

Matches international phone numbers with country code

Phone Numbers

Examples

+1-234-567-8900 +44 1234567890

China Mobile

Matches Chinese mobile phone numbers with optional country code

Phone Numbers

Examples

13812345678 +8613812345678

HTML Tags

Matches HTML tags with or without attributes

HTML

Examples

<div class="example">content</div> <img src="/logo.png" alt="Logo" />

HTML Attributes

Matches HTML attributes with their values

HTML

Examples

class="dark:bg-gray-800" wire:model="search"

Strong Password

Matches passwords with at least 8 characters, including letters, numbers and special characters

Passwords

Examples

Pass@word123 Str0ng!Pass

Complex Password

Matches passwords requiring uppercase, lowercase, numbers and special characters

Passwords

Examples

StrongP@ss123 C0mpl3x!Pass