- 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.3.4 Backslash Sequences

You can put any backslash sequence character class (with the exception of \N) inside a bracketed character class, and it will act just as if you put all the characters matched by the backslash sequence inside the character class. For instance, [a-f\d] will match any digit, or any of the lowercase letters between 'a' and 'f' inclusive.

\N within a bracketed character class must be of the forms \N{name} or \N{U+wide hex char} for the same reason that a dot . inside a bracketed character class loses its special meaning: it matches nearly anything, which generally isn't what you want to happen.

Examples:

/[\p{Thai}\d]/     # Matches a character that is either a Thai
                   # character, or a digit.
/[^\p{Arabic}()]/  # Matches a character that is neither an Arabic
                   # character, nor a parenthesis.

Backslash sequence character classes cannot form one of the endpoints of a range.

ISBN 9781906966027Perl Language Reference ManualSee the print edition