44 |
page. |
page. |
45 |
. |
. |
46 |
. |
. |
47 |
|
.SH "NEWLINE CONVENTIONS" |
48 |
|
.rs |
49 |
|
.sp |
50 |
|
PCRE supports five different conventions for indicating line breaks in |
51 |
|
strings: a single CR (carriage return) character, a single LF (linefeed) |
52 |
|
character, the two-character sequence CRLF, any of the three preceding, or any |
53 |
|
Unicode newline sequence. The |
54 |
|
.\" HREF |
55 |
|
\fBpcreapi\fP |
56 |
|
.\" |
57 |
|
page has |
58 |
|
.\" HTML <a href="pcreapi.html#newlines"> |
59 |
|
.\" </a> |
60 |
|
further discussion |
61 |
|
.\" |
62 |
|
about newlines, and shows how to set the newline convention in the |
63 |
|
\fIoptions\fP arguments for the compiling and matching functions. |
64 |
|
.P |
65 |
|
It is also possible to specify a newline convention by starting a pattern |
66 |
|
string with one of the following five sequences: |
67 |
|
.sp |
68 |
|
(*CR) carriage return |
69 |
|
(*LF) linefeed |
70 |
|
(*CRLF) carriage return, followed by linefeed |
71 |
|
(*ANYCRLF) any of the three above |
72 |
|
(*ANY) all Unicode newline sequences |
73 |
|
.sp |
74 |
|
These override the default and the options given to \fBpcre_compile()\fP. For |
75 |
|
example, on a Unix system where LF is the default newline sequence, the pattern |
76 |
|
.sp |
77 |
|
(*CR)a.b |
78 |
|
.sp |
79 |
|
changes the convention to CR. That pattern matches "a\enb" because LF is no |
80 |
|
longer a newline. Note that these special settings, which are not |
81 |
|
Perl-compatible, are recognized only at the very start of a pattern, and that |
82 |
|
they must be in upper case. |
83 |
|
. |
84 |
|
. |
85 |
.SH "CHARACTERS AND METACHARACTERS" |
.SH "CHARACTERS AND METACHARACTERS" |
86 |
.rs |
.rs |
87 |
.sp |
.sp |
191 |
\ecx "control-x", where x is any character |
\ecx "control-x", where x is any character |
192 |
\ee escape (hex 1B) |
\ee escape (hex 1B) |
193 |
\ef formfeed (hex 0C) |
\ef formfeed (hex 0C) |
194 |
\en newline (hex 0A) |
\en linefeed (hex 0A) |
195 |
\er carriage return (hex 0D) |
\er carriage return (hex 0D) |
196 |
\et tab (hex 09) |
\et tab (hex 09) |
197 |
\eddd character with octal code ddd, or backreference |
\eddd character with octal code ddd, or backreference |
2149 |
.rs |
.rs |
2150 |
.sp |
.sp |
2151 |
.nf |
.nf |
2152 |
Last updated: 09 August 2007 |
Last updated: 21 August 2007 |
2153 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2007 University of Cambridge. |
2154 |
.fi |
.fi |