182 |
.rs |
.rs |
183 |
.sp |
.sp |
184 |
The backslash character has several uses. Firstly, if it is followed by a |
The backslash character has several uses. Firstly, if it is followed by a |
185 |
non-alphanumeric character, it takes away any special meaning that character |
character that is not a number or a letter, it takes away any special meaning |
186 |
may have. This use of backslash as an escape character applies both inside and |
that character may have. This use of backslash as an escape character applies |
187 |
outside character classes. |
both inside and outside character classes. |
188 |
.P |
.P |
189 |
For example, if you want to match a * character, you write \e* in the pattern. |
For example, if you want to match a * character, you write \e* in the pattern. |
190 |
This escaping action applies whether or not the following character would |
This escaping action applies whether or not the following character would |
192 |
non-alphanumeric with backslash to specify that it stands for itself. In |
non-alphanumeric with backslash to specify that it stands for itself. In |
193 |
particular, if you want to match a backslash, you write \e\e. |
particular, if you want to match a backslash, you write \e\e. |
194 |
.P |
.P |
195 |
|
In UTF-8 mode, only ASCII numbers and letters have any special meaning after a |
196 |
|
backslash. All other characters (in particular, those whose codepoints are |
197 |
|
greater than 127) are treated as literals. |
198 |
|
.P |
199 |
If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the |
If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the |
200 |
pattern (other than in a character class) and characters between a # outside |
pattern (other than in a character class) and characters between a # outside |
201 |
a character class and the next newline are ignored. An escaping backslash can |
a character class and the next newline are ignored. An escaping backslash can |
229 |
one of the following escape sequences than the binary character it represents: |
one of the following escape sequences than the binary character it represents: |
230 |
.sp |
.sp |
231 |
\ea alarm, that is, the BEL character (hex 07) |
\ea alarm, that is, the BEL character (hex 07) |
232 |
\ecx "control-x", where x is any character |
\ecx "control-x", where x is any ASCII character |
233 |
\ee escape (hex 1B) |
\ee escape (hex 1B) |
234 |
\ef formfeed (hex 0C) |
\ef formfeed (hex 0C) |
235 |
\en linefeed (hex 0A) |
\en linefeed (hex 0A) |
241 |
.sp |
.sp |
242 |
The precise effect of \ecx is as follows: if x is a lower case letter, it |
The precise effect of \ecx is as follows: if x is a lower case letter, it |
243 |
is converted to upper case. Then bit 6 of the character (hex 40) is inverted. |
is converted to upper case. Then bit 6 of the character (hex 40) is inverted. |
244 |
Thus \ecz becomes hex 1A, but \ec{ becomes hex 3B, while \ec; becomes hex |
Thus \ecz becomes hex 1A (z is 7A), but \ec{ becomes hex 3B ({ is 7B), while |
245 |
7B. |
\ec; becomes hex 7B (; is 3B). If the byte following \ec has a value greater |
246 |
|
than 127, a compile-time error occurs. This locks out non-ASCII characters in |
247 |
|
both byte mode and UTF-8 mode. (When PCRE is compiled in EBCDIC mode, all byte |
248 |
|
values are valid. A lower case letter is converted to upper case, and then the |
249 |
|
0xc0 bits are flipped.) |
250 |
.P |
.P |
251 |
After \ex, from zero to two hexadecimal digits are read (letters can be in |
After \ex, from zero to two hexadecimal digits are read (letters can be in |
252 |
upper or lower case). Any number of hexadecimal digits may appear between \ex{ |
upper or lower case). Any number of hexadecimal digits may appear between \ex{ |
2726 |
.rs |
.rs |
2727 |
.sp |
.sp |
2728 |
.nf |
.nf |
2729 |
Last updated: 17 November 2010 |
Last updated: 20 November 2010 |
2730 |
Copyright (c) 1997-2010 University of Cambridge. |
Copyright (c) 1997-2010 University of Cambridge. |
2731 |
.fi |
.fi |