What is a Regex Cheat Sheet?

A searchable reference of common regular expressions for email, URLs, phone numbers, dates, numbers, Chinese characters, HTML, JSON, and more. Copy any pattern for use in Find & Replace or your code.

How to Use

  1. Browse or search patterns by category.
  2. Click Copy on any pattern.
  3. Use in Find & Replace or your editor.

Tips & Notes

All processing runs locally in your browser. Your text is never uploaded to our servers.

Frequently Asked Questions

Are these JavaScript regex?

Most patterns work in JavaScript and PCRE-like engines. Flags are noted where needed.

Can I test a pattern here?

This page is a reference. Use Find & Replace with regex enabled to test on your text.

Related Tools

Try Find and Replace, Extract URLs and Emails.

How It Works

Static reference list of 50+ common patterns. Copy pattern text for use in Find & Replace (regex mode) or your code editor. Not executed on this page.

High-Frequency Production Regex Patterns Ready to Copy

GoalPatternWatch-Out
ISO Date (YYYY-MM-DD)^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$Validate calendar leap days in code
URL Slug^[a-z0-9]+(?:-[a-z0-9]+)*$Prevents leading/trailing or double hyphens
Hex Color (#RGB / #RRGGBB)^#(?:[0-9a-fA-F]{3}){1,2}$Add {8} if supporting alpha hex

Frequently Asked Questions

What is the difference between greedy (.*) and lazy (.*?) matching?
Greedy .* consumes as much text as possible to the last match on the line, while lazy .*? stops at the earliest possible closing token.
Should I use regex to parse full arbitrary HTML?
No. HTML supports nested tags and edge cases that break regex; use a proper DOM parser for HTML documents and reserve regex for structured flat strings.
How do I match literal dots or brackets?
Escape metacharacters like ., [, ], (, ), +, *, and ? with a preceding backslash.