- publishing free software manuals
Perl Language Reference Manual
by Larry Wall and others
Paperback (6"x9"), 724 pages
ISBN 9781906966027
RRP £29.95 ($39.95)

Sales of this book support The Perl Foundation! Get a printed copy>>>

13.2 Backslashed sequences

Perl regular expressions contain many backslashed sequences that constitute a character class. That is, they will match a single character, if that character belongs to a specific set of characters (defined by the sequence). A backslashed sequence is a sequence of characters starting with a backslash. Not all backslashed sequences are character classes; for a full list, see 12.

Here's a list of the backslashed sequences that are character classes. They are discussed in more detail below.

\d             Match a digit character.
\D             Match a non-digit character.
\w             Match a "word" character.
\W             Match a non-"word" character.
\s             Match a whitespace character.
\S             Match a non-whitespace character.
\h             Match a horizontal whitespace character.
\H             Match a character that isn't horizontal whitespace.
\N             Match a character that isn't newline.  Experimental.
\v             Match a vertical whitespace character.
\V             Match a character that isn't vertical whitespace.
\pP, \p{Prop}  Match a character matching a Unicode property.
\PP, \P{Prop}  Match a character that doesn't match a Unicode
               property.
ISBN 9781906966027Perl Language Reference ManualSee the print edition