Searchlight
Tools
BlogAbout
Free SEO Audit
Back to home
📈SEO & Analytics
🗂️Text & Data
🔐Encoders & Decoders
⚡Generators
🔄Converters
🖼️Image Tools
📄PDF Tools
💻Code Tools
🔍Regex & Parsing
Regex TesterRegex VisualizerRegex CheatsheetCron Tester
🧮Calculators
🗺️Diagrams
🌐Network & Web
✍️Text Utilities
🎨Color Tools
🔀Diff & Compare
148+ tools. OAuth is read-only.
Searchlight

148+ free SEO, developer, image, PDF, and productivity tools - no account needed.

Free · all tools included
Company
  • Blog
  • About
  • Free SEO Audit
Legal
  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2026 Searchlight. All rights reserved.

Read-only OAuth · No data reselling · Completely free

Regex Cheatsheet

Quick reference for regular expression syntax. Click any pattern to copy it.

Anchors

^Start of string (or line in multiline mode)
$End of string (or line in multiline mode)
\bWord boundary - between a word char and a non-word char
\BNot a word boundary
\AStart of string (no multiline)
\ZEnd of string (no multiline)

Character Classes

\dAny digit [0-9]
\DAny non-digit [^0-9]
\wWord character [a-zA-Z0-9_]
\WNon-word character [^a-zA-Z0-9_]
\sWhitespace [ \t\r\n\f]
\SNon-whitespace
.Any character except newline
[abc]Character class - a, b, or c
[^abc]Negated class - not a, b, or c
[a-z]Range - any lowercase letter
[A-Z]Range - any uppercase letter
[0-9]Range - any digit
[a-zA-Z0-9]Alphanumeric characters

Quantifiers

*Zero or more (greedy)
+One or more (greedy)
?Zero or one (greedy)
{n}Exactly n times
{n,}At least n times
{n,m}Between n and m times (inclusive)
*?Zero or more (lazy/non-greedy)
+?One or more (lazy/non-greedy)
??Zero or one (lazy/non-greedy)

Groups & Lookahead

(abc)Capturing group - captures matched text
(?:abc)Non-capturing group - groups without capturing
(?<name>abc)Named capturing group
(?=abc)Positive lookahead - followed by abc
(?!abc)Negative lookahead - not followed by abc
(?<=abc)Positive lookbehind - preceded by abc
(?<!abc)Negative lookbehind - not preceded by abc
a|bAlternation - a or b
\1Backreference to group 1

Flags

gGlobal - find all matches, not just first
iCase-insensitive matching
mMultiline - ^ and $ match line boundaries
sDotall - . matches newline characters too
uUnicode - treat pattern as Unicode code points
ySticky - match from lastIndex position only

Escape Sequences

\nNewline
\tTab
\rCarriage return
\0Null character
\xhhHex character (e.g. \x41 = 'A')
\uhhhhUnicode character (e.g. \u0041 = 'A')
\\Literal backslash
\.Literal dot (escaping special chars)

Common Patterns

^[\w.+-]+@[\w-]+\.[\w.]+$Email address
https?:\/\/[\w\-._~:/?#[\]@!$&'()*+,;=%]+URL (http or https)
\b(?:\d{1,3}\.){3}\d{1,3}\bIPv4 address
\d{4}-\d{2}-\d{2}Date - YYYY-MM-DD
^\+?[\d\s\-().]{7,20}$Phone number (international)
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$Hex color code
^[a-zA-Z0-9_]{3,16}$Username (3-16 chars, alphanumeric + underscore)
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$Password (min 8 chars, upper, lower, digit)
^\d{5}(-\d{4})?$US ZIP code (5 or 9 digit)
<[^>]+>HTML tag
61 patterns across 7 categories

About this tool

A comprehensive regular expression cheatsheet with live testing. Browse syntax for character classes, quantifiers, anchors, groups, lookaheads, and flags. Click any example to test it immediately against sample text. Covers JavaScript, Python, and PCRE flavours. Bookmark it - regex syntax is impossible to memorise completely.

How to Use the Regex Cheatsheet

  1. 1Browse categories: character classes, quantifiers, anchors, groups, flags.
  2. 2Click any syntax example to load it into the live tester.
  3. 3Enter your test string in the input field.
  4. 4Matches are highlighted in real time as you adjust the pattern.
  5. 5Toggle flags (i for case-insensitive, g for global, m for multiline) as needed.

Frequently Asked Questions

What is the difference between greedy and lazy quantifiers?+
Greedy quantifiers (*, +, ?) match as much as possible. Lazy quantifiers (*?, +?, ??) match as little as possible. Example: on '<b>text</b>', the pattern <.*> matches the entire string (greedy), while <.*?> matches just '<b>' (lazy).
What is a lookahead in regex?+
A lookahead asserts that a pattern must (positive: (?=...)) or must not (negative: (?!...)) follow the current position, without consuming characters. For example, \d+(?= dollars) matches numbers followed by ' dollars' without including ' dollars' in the match.
What is the difference between ^ and \b?+
^ anchors to the start of the string (or line in multiline mode). \b is a word boundary - it matches between a word character and a non-word character. Use ^ to match the very start; use \b to match whole words anywhere in the string.
What regex flavour does JavaScript use?+
JavaScript uses its own ECMAScript regex engine. It supports most PCRE features but lacks lookbehind (added in ES2018), atomic groups, and possessive quantifiers. Python uses the re module which is PCRE-compatible with minor differences.
Looking for a deeper guide on this topic? Browse the Searchlight blog.
Visit the blog →

Related tools

View all Regex & Parsing →
Regex TesterLive regex matching with group highlightingRegex VisualizerVisual diagram of regex structureCron TesterTest cron expressions with next-run preview