Download Dr.Web Enterprise Security Suite

Transcript
Appendices
K3. Use of Metacharacters
Backslash (\)
The backslash character has several uses. When it is followed by a
non-alphanumeric character, it takes away any special meaning that
character may have. This use of backslash as an escape character
applies both inside and outside character classes.
For example, if you want to match a * character, you should write \*
in the pattern. This escaping action applies whether or not the
following character would otherwise be interpreted as a
metacharacter, so it is always safe to precede a non-alphanumeric with
backslash to specify that it stands for itself. In particular, if you want
to match a backslash, you write \\.
If a pattern includes the PCRE_EXTENDED option, whitespaces
(other than in a character class) in the pattern, characters between #
outside a character class and the next newline character will be
ignored. An escaping backslash can be used to include a whitespace
or # character as part of the pattern.
If you want to remove the special meaning from a sequence of
characters, you can do so by putting them between \Q and \E. The
\Q...\E sequence works both inside and outside character classes.
Non-printing characters
Backslash provides a way of encoding non-printing characters in
patterns to make them visible. There is no restriction on the
appearance of non-printing characters, apart from the binary zero at
the end of a pattern. But when a pattern is being created in a text
editor, it is usually easier to use one of the following escape sequences
than the binary character it represents:
\a
alarm, i.e., the BEL character (hex 07)
Administrator Manual
402