Search This Blog

Saturday, November 24, 2018

JavaScript regular expression predefined character classes and the characters they match.

.The period matches any single character, except line terminators (e.g., a newline).
\dA single digit character (i.e., [0-9]).
\DA single non-digit character (i.e., [^0-9]).
\wA single alphanumeric word character, including the underscore (i.e., [A-Za-z0-9_]).
\WA single non-word character (i.e., [^A-Za-z0-9_]).
\sA single whitespace character. This includes space (), tab (\t), form feed, line feed, and other Unicode spaces.
\SA single non-whitespace character (i.e., [^\w]).