The shorthand of character classes

Class

Description

\w

Characters comprising a word, as in [a-zA-Z0-9_]

\W

Characters not consisting a word, as in [^a-zA-Z0-9_]

\s

Spaces

\S

Characters excluding spaces

\d

Numbers, as in [0-9]

\D

Characters excluding numbers, as in [^0-9]