Multiple-Character Escapes
There are also escapes that represent multiple characters. They are:
\sAny whitespace character
\SAnything other than a whitespace character
\dAny digit
\DAnything other than a digit
\wAny word character. Word characters are all characters except the punctuation, separator and other characters (the character groups defined with P, Z and C).
\WAnything other than a word character.
\iAny character that can be the first letter of an XML name. That includes the underscore (
_), the colon (:), and characters of all the world’s languages defined as letters in the XML specification.\IAnything other than a character that can be the first letter of an XML name.
\cAny character that can be used in an XML name. That includes all of the characters that can appear as the first character (
\i), plus the period (.), hyphen (–), and the characters defined as digits, combining characters and extenders in the XML specification.\CAnything other than a character that can be used in an XML name.
\pA character in the following named character group. For example,
\p{Nd}matches a numeric digit, while\p{IsThai}matches a Thai character.\PAnything other than a character in the following named character group. For example,
\P{Nd}matches anything except a numeric digit, while\P{IsThai}matches anything except a Thai character.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access