regular expression 2 character classes
by webproger on 2020-03-22
<JavaScript>
.    (The decimal point) matches any single character except the newline character.
[xyz]    A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen.
[^xyz]   A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen.
\w    Matches any alphanumeric character including the underscore. Equivalent to [A-Za-z0-9_].
\W    Matches any non-word character. Equivalent to [^A-Za-z0-9_].
\s    Matches a single white space character, including space, tab, form feed, line feed.
      Equivalent to [ \f\n\r\t\u00A0\u2028\u2029].
\S    Matches a single character other than white space.
      Equivalent to [^ \f\n\r\t\u00A0\u2028\u2029].
\d    Matches a digit character. Equivalent to [0-9].
\D    Matches any non-digit character. Equivalent to [^0-9].

<PHP PCRE>
.     Outside a character class, a dot in the pattern matches any one character in the subject, including a non-printing character, but not (by default) newline. If the PCRE_DOTALL option is set, then dots match newlines as well.
[]    A character class matches a single character in the subject.
If a closing square bracket is required as a member of the class, it should be the first data character in the class (after an initial circumflex, if present) or escaped with a backslash.
If a circumflex is actually required as a member of the class, ensure it is not the first character, or escape it with a backslash.
If a minus character is required in a class, it must be escaped with a backslash or appear in a position where it cannot be interpreted as indicating a range, typically as the first or last character in the class.
The octal or hexadecimal representation of "]" can also be used to end a range.
\d    any decimal digit
\D    any character that is not a decimal digit
\s    any whitespace character
\S    any character that is not a whitespace character
\w    any word character. A word character is any letter or digit or the underscore character.
\W    any non-word character