RegEx Cheat Sheet & Generator
Generate common regular expressions dynamically or review anchors, quantifiers, and groupings with our interactive reference sheet.
RegEx Quick Reference
Character Classes
Quantifiers
Anchors
Groups & Ranges
Regular Expression Theory & Pattern Matching Architecture
A Regular Expression (RegEx or RegExp) is a sequence of characters that specifies a search pattern in text. Originating in theoretical computer science (formal language theory and Stephen Kleene's regular sets), regular expressions are supported natively across every major programming language via state machine engines (Deterministic and Nondeterministic Finite Automata - DFA and NFA).
RegEx patterns power search-and-replace routines, form input validation (email addresses, phone numbers, UUIDs), log parsing, and data scraping. However, due to its dense, compact syntax containing meta-characters, quantifiers, anchors, and lookarounds, writing correct patterns can be challenging even for experienced developers.
Our RegEx Generator & Cheat Sheet provides a visual catalog of pre-built, production-tested regular expressions alongside an interactive builder to construct custom regex patterns with immediate verification.
Common Production RegEx Patterns Cheat Sheet
Standard regex patterns for everyday development tasks:
- Email Address Validation:
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ - URL / Web Address:
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*) - IPv4 Address:
^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$ - ISO 8601 Date (YYYY-MM-DD):
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$ - UUID v4:
^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ - Strong Password (8+ chars, 1 uppercase, 1 digit, 1 special):
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Regular Expression Engine Flags (g, i, m, s, u)
Regex flags alter the global matching behavior of the pattern:
g(Global): Find all matching occurrences rather than stopping after the first match.i(Case-Insensitive): Match characters regardless of uppercase or lowercase distinctions.m(Multiline): Causes^and$to match the start and end of individual lines rather than the entire string.s(DotAll): Allows the wildcard dot (.) to match newline characters.u(Unicode): Enables full UTF-16 surrogate pair matching for international characters and emojis.
Preventing Catastrophic Backtracking (ReDoS)
Regular Expression Denial of Service (ReDoS) occurs when an NFA regex engine encounters nested quantifiers over overlapping patterns (e.g. (a+)+$). When tested against a string of 30 "a" characters followed by an "x", the engine evaluates millions of combinations, freezing server CPUs. Always test patterns with regex profilers and avoid nested greedy quantifiers.
Related Text & Code Formatters
Chain RegEx Cheat Sheet & Generator with these complementary client-side utilities from our Text & Code Formatters collection:
Test your regular expressions in real-time with capture groups, matches count, regex flags, and syntax highlighting. 100% private, client-side.
Reverse text online instantly. Swap letters, reverse words, reverse character orders, or flip line order. Computes character and word counts. 100% offline.
Parse user agent strings instantly. Detect browser version, operating system, device categories, and rendering engines. 100% offline and private.
Compare two text files or snippets side by side. Highlight differences, additions, and deletions online. 100% secure and client-side.
Frequently Asked Questions
Greedy quantifiers (like .* or +) match as much text as possible. Appending a question mark (.*? or +?) makes them lazy, matching the smallest possible substring.
A lookahead (?=...) checks if a specific pattern follows the current position without including those characters in the matched result.
The official RFC 5322 email specification permits comments, quotes, and esoteric characters, resulting in a regex over 6,000 characters long. Practical web applications use simplified regexes combined with verification emails.
Yes. As you select or modify patterns, matches in sample text are highlighted instantly in your browser.
No. All regex compilation and matching occur 100% locally via the browser's native RegExp JavaScript engine.