JavaScript regex metacharacters


Metacharacter Alternative Description
\d [0-9] Match any digit character
\D [^0-9] Match any non-digit character
\w [a-zA-Z0-9_] Match any word character
\W [^a-zA-Z0-9_] Match any non-word character
\s   Match any whitespace character (space, tab, newline)
\S   Match any non-whitespace character
\0   Match null character
\t   Match tab character
\n   Match newline character
\r   Match carriage return character
.   Match any character except newline

Sources:



Please support this site and join our Discord!