{ }
DevToolsLabs

Regex Searchable Reference (Common Pattern Library)

For developers, writing a regular expression from scratch is often a journey into 'regex hell'. Instead of wasting time debugging complex character classes, our Searchable Reference Hub provides a curated library of standard, battle-tested patterns. Whether you need to validate a strict V4 UUID, extract HTML tags from a string, or enforce complex password security rules, you can find and copy the exact expression you need in seconds.

100% Private & Secure

This tool runs completely inside your browser using client-side WebAssembly and JS. Zero data is ever sent to our servers.

Validation

Email Address

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Standard RFC 5322 compliant email validation.

System

IPv4 Address

^(?:(?: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]?)$

Validates standard 32-bit IP addresses.

Frontend

URL (HTTP/HTTPS)

^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$

Matches standard web addresses with optional protocol.

Data Extraction

ISO Date (YYYY-MM-DD)

^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$

Matches the standard ISO 8601 date format.

Validation

Phone Number (US)

^\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}$

Flexible US and international phone formats.

Validation

Credit Card (General)

^(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$

Matches Visa, Mastercard, Amex, and more.

Validation

Strong Password

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{12,}$

Min 12 chars, 1 uppercase, 1 number, 1 special char.

Data Extraction

HTML Tag

<(\/?[a-zA-Z0-9]+)(\s+[^>]*?)?>

Extracts opening and closing HTML tags.

Frontend

Hex Color Code

^#?([a-fA-G0-9]{3}|[a-fA-G0-9]{6})$

Validates 3 or 6 digit hex color strings.

Validation

Username (Alphanumeric)

^[a-zA-Z0-9_]{3,16}$

3-16 chars, alphanumeric and underscores.

System

UUID (Version 4)

^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

Strict validation for v4 UUID strings.

Frontend

URL Slug

^[a-z0-9]+(?:-[a-z0-9]+)*$

Lowercase, hyphen-separated permalinks.

Mastering Regular Expressions
What is ^ and $?

These are 'anchors'. ^ matches the beginning of a string, and $ matches the end. Together, they ensure the entire string matches your pattern exactly.

The Power of + and *

Quantifiers! + means 'one or more' of the preceding character, while * means 'zero or more'. Use ? to make a search 'lazy' or optional.

What are [ ] brackets?

Character sets. [a-z] matches any lowercase letter. [^0-9] matches anything that IS NOT a number. Very useful for strict filtering.

How to use this tool

  1. Use the visual search bar above to type what you are trying to match (e.g., 'email' or 'hex').
  2. Browse the results across categories like Validation, System, and Frontend.
  3. Each pattern includes a detailed description explaining what it actually does under the hood.
  4. Click 'Copy Pattern' to save the raw string to your clipboard.
  5. Paste the expression into your project's `.test()` or `.match()` function.

Example Usage

Input
Search: "IPv4"
Output
Pattern: ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}...

When to use this tool

  • Frontend developers building form validation logic for emails, passwords, and phone numbers.
  • Data engineers extracting specific fields (like ISO dates or colors) from large log files.
  • Backend developers enforcing strict input constraints on API endpoints (e.g., UUID validation).
  • A11y/UI testing where you need to verify if strings follow specific structural patterns.

Frequently Asked Questions

Are these regex patterns JavaScript-compatible?

Yes. All patterns in this library are written to be compatible with standard PCRE and JavaScript RegExp engines. For use in Java or Go, you may occasionally need to double-escape backslashes (e.g., \\d instead of \d).

Can I test these patterns with my own data?

Absolutely. We recommend using our 'Regex Match & Extract' tool to paste these patterns into a live tester where you can see how they highlight your actual test strings in real-time.

What does the 'Validation' category mean?

Validation patterns are designed to return a true/false match for a specific format. They typically start with ^ and end with $ to ensure the entire string conforms to the rule.

Are these patterns officially 'Perfect'?

Regex is a trade-off between strictness and usability. For example, our email pattern covers 99.9% of standard web usage, but RFC-compliant email validation is notoriously complex. These are designed for real-world production reliability.

Is this tool updated regularly?

Yes, we continuously add new patterns based on the highest-volume search queries we see in our logs, ensuring the database stays relevant for modern framework development.

More Developer Tools