Character classes

Character classes
Sequence Description
[...] A single character listed or contained within a listed range. Ranges can be combined with the {+} and {-} operators. For example [a-z]{+}[0-9] is the same as [0-9a-z] and [a-z]{-}[aeiou] is the same as [b-df-hj-np-tv-z].
[^...] A single character not listed and not contained within a listed range.
. Any character, default [^\n].
\d Digit character, [0-9].
\D Non-digit character, [^0-9].
\s White space character, [ \t\n\r\f\v].
\S Non-white space character, [^ \t\n\r\f\v].
\w Word caracter, [a-zA-Z0-9_].
\W Non-word caracter, [^a-zA-Z0-9_].

关注编程学问公众号