Regex Cheatsheet & Snippet Library

A searchable reference of over 30 commonly needed regular expressions, covering email addresses, URLs, IPv4 addresses, phone numbers, HEX colors, UUIDs, ISO dates and datetimes, HTML tag stripping, Markdown links, file paths, password strength, and more. Each entry comes with a plain-English explanation of what it matches and why it's written the way it is. Filter by keyword to find the pattern you need, then copy it with one click and drop it into your code. This is a reference tool, not a regex tester; every pattern listed has been checked against real matching and non-matching sample strings.

PrivateFreeWorks offline

Reviewed by Vincenzo Manto, Founder & Lead Developer · Last updated September 27, 2026

How it works

  1. 1

    Browse the patterns grouped by category: Web & Contact, Identifiers, Dates & Times, Numbers & Text, Passwords, HTML & Code, and Files.

  2. 2

    Type a keyword into the filter box (like 'email', 'date', or 'hex') to instantly narrow the list to matching patterns.

  3. 3

    Read each pattern's plain-English description to confirm it fits your use case before using it.

  4. 4

    Click 'Copy' next to any pattern to copy just the regex string to your clipboard.

Why keep a regex cheatsheet instead of writing patterns from scratch

Regular expressions are easy to get subtly wrong: an email pattern that forgets the TLD length, an IPv4 pattern that accepts '999.999.999.999', or a date pattern that lets through '2024-13-45'. Reaching for a pattern that's already been checked against real edge cases saves the trial and error of writing and re-testing one from memory each time the need comes up.

Organized for browsing, not just search-and-copy

Beyond the filter box, patterns are grouped into categories: Web & Contact, Identifiers, Dates & Times, Numbers & Text, Passwords, HTML & Code, and Files. That lets you browse a category you know you need, like Dates & Times, even when you don't remember the exact label of the pattern you're after.

Frequently asked questions

Are these patterns guaranteed to be 100% correct for every edge case?

They're solid, commonly used patterns that cover the vast majority of real-world inputs (e.g. the email pattern handles typical addresses but, like most practical email regexes, doesn't implement the full, extremely permissive RFC 5322 grammar). Each has been spot-checked against sample matching and non-matching strings, but for something like email validation, pairing a reasonable regex with an actual confirmation email is always more reliable than any pattern alone.

What regex flavor are these written for?

Standard JavaScript/ECMAScript regex syntax, which is also close to PCRE (used by PHP, Python's `re` with minor differences, and many other languages). Most patterns here will work as-is, or with a trivial adjustment, in other languages.

Can I search by what the pattern does, not just its name?

Yes, the filter box matches against the category, label, and description text too, so searching 'strip' finds the HTML tag stripper, and searching 'password' finds both password-related patterns.

Does this tool test my own text against a pattern?

No, this is a reference and snippet library, not a live regex tester. It shows you the patterns and copies them to your clipboard so you can paste them into your own code or a dedicated regex tester.

Is anything I type here sent anywhere?

No. The filter runs entirely in your browser against a local list of patterns; nothing is uploaded.

Related tools