shorthand · sets · ranges · unicode properties

Every regex character class with a live demo

From \d to \p{Script=Greek} — descriptions, ASCII equivalents, and live match previews against curated samples.

Regex Character Classes
Classes
15
tokens
Live demos
15
matched
Unicode
5
u flag
ASCII
10
core
class · token + meaning
\dDigit/g
Any decimal digit.
≡ [0-9]
\DNon-digit/g
Anything that is not a decimal digit.
≡ [^0-9]
\wWord character/g
ASCII word characters.
≡ [A-Za-z0-9_]
\WNon-word character/g
Anything not in \w.
≡ [^A-Za-z0-9_]
\sWhitespace/g
Spaces, tabs, newlines, etc.
≡ [ \t\n\r\f\v]
\SNon-whitespace/g
Any non-whitespace character.
≡ [^ \t\n\r\f\v]
.Any character/g
Any character except newline (unless s flag).
[abc]Set/g
Any one of the listed characters.
[^abc]Negated set/g
Any single character NOT in the set.
[a-z]Range/g
Any character in the inclusive range.
\p{L}Unicode letter/gu
Any Unicode letter — requires the u flag.
\p{N}Unicode number/gu
Any Unicode numeric character — requires u flag.
\p{P}Unicode punctuation/gu
Any Unicode punctuation mark — requires u flag.
\p{Z}Unicode separator/gu
Any space/separator character — requires u flag.
\p{Script=Greek}Greek script/gu
Characters from the Greek script — requires u flag.
demo · sample + matches
Order #1234 placed on 2026-05-18.
12 matches · "1", "2", "3", "4", "2", "0", "2", "6", "0", "5", "1", "8"
abc123
3 matches · "a", "b", "c"
snake_case-9 and CamelCase!
23 matches · "s", "n", "a", "k", "e", "_", "c", "a", "s", "e", "9", "a" …
hello, world!
3 matches · ",", " ", "!"
one two three four
3 matches · "\t", " ", "\n"
alpha beta gamma
14 matches · "a", "l", "p", "h", "a", "b", "e", "t", "a", "g", "a", "m" …
a.b c-d e_f
11 matches · "a", ".", "b", " ", "c", "-", "d", " ", "e", "_", "f"
abracadabra
8 matches · "a", "b", "a", "c", "a", "a", "b", "a"
abracadabra
3 matches · "r", "d", "r"
Hello World 123
8 matches · "e", "l", "l", "o", "o", "r", "l", "d"
café niño 漢字 ☃
10 matches · "c", "a", "f", "é", "n", "i", "ñ", "o", "漢", "字"
Roman Ⅻ, Arabic 12, Hindi १२
5 matches · "Ⅻ", "1", "2", "१", "२"
Hello, world! — 你好。
4 matches · ",", "!", "—", "。"
a b c d
3 matches · " ", " ", " "
Use Δ for delta, α for alpha.
2 matches · "Δ", "α"
Quick Start

How to read the character class reference

Every shorthand class on one page with a live match preview.

  1. 01

    Scan the list

    15 classes from ASCII shorthand to Unicode properties.

    The list spans POSIX shorthand (\d, \w, \s), negations (\D), and the ECMAScript 2018 Unicode property escapes (\p{L}, \p{Script=Greek}) — gated by the u flag.

    navECMAScriptUnicodePOSIX
    classes · indexed15 · ECMA
    \d \w \s \p{L}…
    loaded · indexedECMA · ready
  2. 02

    Read description

    Each row has a name, description, ASCII equivalent.

    ASCII expansions are exact — \d is [0-9] without the u flag, and the Unicode-aware variant matches all decimal digits across scripts when u is on.

    readASCIIexpansionreference
    token · documented\d · regex
    Digit — [0-9]
    ready · documentedASCII · ECMA
  3. 03

    Check live demo

    The sample plus match count makes each class concrete.

    Each demo runs through the JavaScript RegExp engine with sensible flags — what you see here is byte-identical to what your code will produce.

    demolivematch countRegExp
    run · matches4 · live
    "1234" "2026" "05" "18"
    matches · livegroups · live
  4. 04

    Copy to use

    Click Copy on any row to grab the class.

    Tokens copy through navigator.clipboard.writeText, so they paste cleanly into regex101, your editor, or a unit-test fixture.

    copyclipboardexportinstant
    export · exportedready · saved
    ✓ Copied \d
    ready to shipsuccess
Pro tips

Regex patterns that don't melt down

Use named groups

(?<year>\d{4}) reads better than $1 and survives reordering. Supported in ECMAScript 2018+.

Anchor strictly

Use ^/$ with the m flag when matching whole lines. Without anchors, partial matches sneak through.

Avoid catastrophic backtracking

Nested quantifiers like (a+)+ can explode. Run patterns through ReDoS Detector first.

Escape every literal

Backslash any meta character you want literally: \.\$\^\*\+\?\(\)\[\]\{\}\|\\.

Test edge cases

Empty string, single character, unicode, the maximum length you expect — write fixtures for each.

Patterns aren&rsquo;t parsers

Don’t parse HTML, JSON, or balanced parens with regex. Use a proper parser when the grammar is recursive.

Use Cases

When to consult character classes

Authoring, debugging, code review.

Pick the right class

Decide between \d, [0-9], and \p{N}. Compiles through the JavaScript RegExp constructor — engine quirks (Unicode property escapes, sticky matching, named groups) work when their flags are on. Error messages cite the exact position of any syntax issue.

ReDoS-safe

Unicode-correct

Use \p{L} when ASCII won't cut it. Pairs with the ReDoS detector to catch catastrophic backtracking before you deploy. A pattern that handles 1k-character input fine can become a denial-of-service vector on attacker-controlled 1M-character input.

i18n

Code review

Spot \w that should be \p{L} for non-ASCII. Output exports as JavaScript, Python re, Java util.regex, .NET System.Text.RegularExpressions, PCRE, and POSIX — language quirks are highlighted on conversion so you don't ship a JS-only pattern to a Go service.

spec-grade

Author readable regex

Shorter classes mean shorter regex. Capture groups (named or numbered) round-trip cleanly into replacement strings, JSON output, or CSV extraction without re-typing. Backreferences ($1, ${name}) preserve semantics across languages.

cross-engine

Teach

One page covers everything — perfect classroom material. Test against edge cases — empty input, single character, max length, multibyte boundaries — to catch off-by-one and zero-length match bugs before they reach production.

test-ready

Cross-flavour

Confirm a class works in your target engine. All matching runs client-side so secret patterns never leave the browser. Useful when the pattern itself is sensitive (PII regexes, internal data formats, security filters).

production-ready
FAQ

Frequently asked questions

Whenever you use \p{...} or \P{...}. Without /u those tokens are parsed as literals.
No — \w is ASCII-only in JS. Use \p{L} (with /u) for any Unicode letter.
\d is shorter and more readable. [0-9] is what some style guides prefer.
JS doesn't support POSIX classes — use \p{L} or [A-Za-z] instead.
No. The whole reference runs locally in your browser.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!