Regex Character Classes
Classes
15
tokens
Live demos
15
matched
Unicode
5
u flag
ASCII
10
core
class · token + meaning
\dDigit/gAny decimal digit.
≡
[0-9]\DNon-digit/gAnything that is not a decimal digit.
≡
[^0-9]\wWord character/gASCII word characters.
≡
[A-Za-z0-9_]\WNon-word character/gAnything not in \w.
≡
[^A-Za-z0-9_]\sWhitespace/gSpaces, tabs, newlines, etc.
≡
[ \t\n\r\f\v]\SNon-whitespace/gAny non-whitespace character.
≡
[^ \t\n\r\f\v].Any character/gAny character except newline (unless s flag).
[abc]Set/gAny one of the listed characters.
[^abc]Negated set/gAny single character NOT in the set.
[a-z]Range/gAny character in the inclusive range.
\p{L}Unicode letter/guAny Unicode letter — requires the u flag.
\p{N}Unicode number/guAny Unicode numeric character — requires u flag.
\p{P}Unicode punctuation/guAny Unicode punctuation mark — requires u flag.
\p{Z}Unicode separator/guAny space/separator character — requires u flag.
\p{Script=Greek}Greek script/guCharacters 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 · "Δ", "α"