RegEx Cheat Sheet & Generator

Generate common regular expressions dynamically or review anchors, quantifiers, and groupings with our interactive reference sheet.

Generated Regular Expression
/^.*$/i
Quick Templates
Custom Pattern Builder

RegEx Quick Reference

Character Classes

. Any single character except newline \d Any digit (0-9) \D Any non-digit character \w Alphanumeric character + underscore \W Non-alphanumeric character \s Whitespace (space, tab, newline) \S Non-whitespace character

Quantifiers

* 0 or more times + 1 or more times ? 0 or 1 time (optional) {n} Exactly n times {n,} n or more times {n,m} Between n and m times

Anchors

^ Start of line / string $ End of line / string \b Word boundary \B Non-word boundary

Groups & Ranges

(x) Capture group (?:x) Non-capturing group [abc] Any character inside bracket (a, b, or c) [^abc] Any character NOT inside bracket [a-z] Any lowercase letter range x|y Matches either x or y
Source Code & Strings • Technical Reference Mastering Regular Expressions: Zero to Hero Guide

Working with RegEx Cheat Sheet & Generator? Read our architectural guide or browse all utilities in the Text & Code Formatters Hub.

Read Guide →

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:

Regular Expression Engine Flags (g, i, m, s, u)

Regex flags alter the global matching behavior of the pattern:

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:

RegEx Tester & Visualizer →

Test your regular expressions in real-time with capture groups, matches count, regex flags, and syntax highlighting. 100% private, client-side.

Text String Reverser →

Reverse text online instantly. Swap letters, reverse words, reverse character orders, or flip line order. Computes character and word counts. 100% offline.

User Agent Parser →

Parse user agent strings instantly. Detect browser version, operating system, device categories, and rendering engines. 100% offline and private.

Text Diff Checker →

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.