๐Ÿ“ Regex Cheat Sheet

Interactive regex reference + live tester โ€” Character Classes / Quantifiers / Anchors / Groups / Pattern Library
Zero Dependencies | No Signup, Client-Side ยท No Server Uploads

๐Ÿ“– Regex Syntax Reference

Character Classes

.Any char (except newline)
\\dDigit [0-9]
\\DNon-digit [^0-9]
\\wWord char [a-zA-Z0-9_]
\\WNon-word char
\\sWhitespace
\\SNon-whitespace
[abc]Character set
[^abc]Negated set
[a-z]Range

Quantifiers

*0 or more
+1 or more
?0 or 1
{n}Exactly n
{n}n or more
{n,m}n to m
*?Non-greedy 0+
+?Non-greedy 1+

Anchors & Boundaries

^Start of line
$End of line
\\bWord boundary
\\BNon-word boundary

Groups & Assertions

(abc)Capturing group
(?:abc)Non-capturing group
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind
\\1Backreference
(?<name>abc)Named group

๐Ÿงช Live Tester

๐Ÿ“ฆ Common Pattern Library

What Can the Regex Cheat Sheet Do?

The Regex Cheat Sheet is a free online tool that provides an interactive regex syntax reference and live testing. It covers character classes, quantifiers, anchors, groups, assertions, and all common syntax elements, with a built-in live match tester and 20+ common pattern library. All processing is done locally in your browser.

Core Features

How to Use

1. Click syntax elements in the reference to insert them into the regex input

2. Enter or edit your regex pattern in the input field

3. Toggle regex flags (g/i/m/s/u) to adjust matching behavior

4. Enter test text in the text area

5. View real-time match highlighting and group information

6. Select common patterns from the library to use instantly

Use Cases

Case 1: Form Validation

Quickly find email, phone, and ID validation patterns, test them, and use directly in frontend form validation.

Case 2: Log Analysis

Write regexes to extract key information from logs (IPs, timestamps, error codes) with real-time testing.

Case 3: Data Cleaning

Use regex for batch text replacement and extraction โ€” remove HTML tags, extract URL parameters.

Case 4: Learning Regex

Learn regex syntax through the cheat sheet and live tester, understanding each syntax element's effect.

Technical Background

Regular Expressions are a powerful tool for describing string patterns, introduced by mathematician Stephen Kleene in the 1950s. Modern regex engines are divided into NFA (Non-deterministic Finite Automaton) and DFA (Deterministic Finite Automaton). JavaScript uses an NFA engine supporting backtracking and capturing groups. "Greedy" vs "non-greedy" modes affect matching behavior: greedy matches as much as possible, non-greedy as little as possible. Complex regexes can cause "catastrophic backtracking" โ€” watch for performance. ES2018 introduced named capture groups and lookbehind assertions; ES2024 introduced Unicode property escapes \\p{}.

โ“ What can the Regex Cheat Sheet do?

Provides interactive regex syntax reference and live testing with 20+ common pattern library.

โ“ What regex syntax is supported?

Supports standard ECMAScript regex including character classes, quantifiers, anchors, groups, lookahead/lookbehind, and Unicode properties.

โ“ Is there a common pattern library?

Yes. Includes 20+ common patterns for email, URL, phone, IP, date, and more.

โ“ Does it support real-time match highlighting?

Yes. Matches are highlighted in real time with position and group details.

โ“ Which regex flags are supported?

Supports g (global), i (case-insensitive), m (multiline), s (dotAll), and u (Unicode) flags.

โ“ Does this tool upload my data?

No. All regex matching is done locally in your browser.

Regex Cheat Sheet | No Signup, Client-Side ยท No Server Uploads

Feedback: dexshuang@google.com