Regex Cheat Sheet

Covers the most-used JavaScript/PCRE metacharacters, quantifiers, groups, and flags (i/g/m). Pair with our Regex Tester to look up syntax and validate matches live.

Privacy: processed locally, never uploaded.

↓ Paste in the input area below to see results instantly

Regex syntax and common pattern cheat sheet; pair with the Regex Tester for live validation.

.

Any character except newline

a.b matches acb

\d

Digit [0-9]

\d+ matches 123

\w

Word character [A-Za-z0-9_]

\w+

\s

Whitespace

\s+

^

Start of string/line

^Hello

$

End of string/line

world$

*

Zero or more (greedy)

ab*c

+

One or more

\d+

?

Zero or one

colou?r

{n,m}

Between n and m times

\d{2,4}

[]

Character class

[A-Za-z]+

[^]

Negated class

[^0-9]+

|

Alternation

cat|dog

()

Capturing group

(\d{4})-(\d{2})

(?:)

Non-capturing group

(?:https?)://

(?=)

Positive lookahead

(?=\d{3})

(?!)

Negative lookahead

(?!bad)

\b

Word boundary

\bword\b

i flag

Case insensitive

/hello/i

g flag

Global (all matches)

/\d/g

m flag

Multiline ^ $

/^line/m

Notes

Note

Covers common JavaScript/PCRE metacharacters and flags; engine behavior may vary slightly.

Covers the most-used JavaScript/PCRE metacharacters, quantifiers, groups, and flags (i/g/m). Pair with our Regex Tester to look up syntax and validate matches live.

Quick start

  1. Browse entries

    From ., \d, ^$ to lookaheads and word boundaries.

  2. Search

    Filter by pattern, description, or example.

  3. Copy and test

    Copy into the Regex Tester to validate.

Engine differences

JavaScript, Python, and Go regex differ slightly; this sheet focuses on JS RegExp—verify when porting.

Core Syntax Quick Reference

^ and $ match the start and end of a string respectively. For example, ^\d+$ ensures the entire string consists of digits. \b matches word boundaries - \bword\b won't match 'keyword'. Escape special characters with backslashes, like \. for literal dots.

Quantifiers control repetition: ? for 0 or 1, + for 1 or more, * for any count, {n,m} for ranges. Greedy matching (default) captures longest possible text. Add ? for lazy mode, like a.*?b to match shortest a...b segment.

Examples

Example

Input

\d+

Output

One or more digits

FAQ

vs Regex Tester?

Memo is a static syntax sheet; the tester runs live matches on your strings.

Data uploaded?

No.

How to test complex regex patterns?

Build regex incrementally: test basic parts first, then add conditions progressively. Use our regex tester to visualize matches in real-time - browser console shows syntax errors. For long texts, test with samples first.