work with Unicode characters as well. To match a Cyrillic character, for example, use /[\u0400-\u04FF]/. The regular-expression syntax includes shortcuts for a few commonly used character classes. Table 9-2 lists these characters and summarizes character-class syntax. Table 9-2. Regular expression character classes Character Matches [...]
Any one character between the brackets.
[^...]
Any one character not between the brackets.
.
Any character except newline or another Unicode line terminator.
\w
Any ASCII word character. Equivalent to [a-zA-Z0-9_].
\W
Any character that is not an ASCII word character. Equivalent to [^a-zAZ0-9_].
\s
Any Unicode whitespace character.
\S
Any character that is not Unicode whitespace. Note that \w and \S are not the same thing.
\d
Any ASCII digit. Equivalent to [0-9].
\D
Any character other than an ASCII digit. Equivalent to [^0-9].
[\b]
A literal backspace (special case).
Note that the special character-class escapes can be used within square brackets. \s matches any whitespace character, and \d matches any digit, so /[\s\d]/ matches any one whitespace character or digit.
Repetition A character or character class may be followed by additional characters that specify how many times those characters should be matched. Table 9-3 summarizes the repetition syntax.
152 | Chapter 9: Regular Expressions