Interactive regex reference with searchable syntax table, live pattern tester, and 25+ common patterns ready to copy. Click any row to test it instantly.
Quick Pattern Tester
Enter a regex pattern above to see matches highlighted here...
Regex Syntax Reference
Click any row to load it into the pattern tester above.
Pattern
Description
Example
Matches
No matching syntax found. Try a different search term.
Common Regex Patterns
25+ pre-built patterns for everyday tasks. Click to test, or copy directly to your project.
About This Regex Cheat Sheet
Regular expressions (regex) are powerful pattern-matching tools used in every major programming language. This interactive cheat sheet covers the complete regex syntax with searchable reference, live testing, and ready-to-use patterns.
Whether you are validating user input, parsing log files, or performing find-and-replace operations, this reference has the syntax and examples you need. All testing runs entirely in your browser using JavaScript's built-in RegExp engine.
Features
Searchable syntax reference with 60+ regex patterns and descriptions
Live pattern tester with real-time match highlighting
25+ pre-built common patterns (email, URL, IP, phone, dates, and more)
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for string matching, validation, search-and-replace, and text parsing in virtually every programming language. Common uses include validating email addresses, extracting data from logs, and finding patterns in text.
What is the difference between greedy and lazy quantifiers?▼
Greedy quantifiers (*, +, {n,m}) match as many characters as possible, while lazy quantifiers (*?, +?, {n,m}?) match as few characters as possible. For example, given the string '<b>bold</b>', the greedy pattern '<.*>' matches the entire string, while the lazy pattern '<.*?>' matches only '<b>'. Use lazy quantifiers when you want the shortest possible match.
How do lookaheads and lookbehinds work in regex?▼
Lookaheads and lookbehinds are zero-width assertions that match a position without consuming characters. A positive lookahead (?=...) asserts that what follows matches the pattern. A negative lookahead (?!...) asserts that what follows does NOT match. Lookbehinds work the same way but check what comes before: (?<=...) for positive and (?<!...) for negative. For example, '\d+(?= dollars)' matches digits only when followed by ' dollars'.
Keyboard Shortcuts
Ctrl+Enter Run / Test Ctrl+Shift+C Copy output Ctrl+L Clear