Skip to content
Regex

Character Classes

Match sets and ranges of characters.

#character-class#shorthand

Code

regex
[abc]      any of a, b, c
[^abc]     none of a, b, c
[a-z]      range a to z
[A-Z0-9]   uppercase letter or digit
\d         digit          [0-9]
\D         non-digit
\w         word char      [A-Za-z0-9_]
\W         non-word char
\s         whitespace
\S         non-whitespace
.          any char except newline