| 47 |
.\" HREF |
.\" HREF |
| 48 |
\fBpcrecompat\fR |
\fBpcrecompat\fR |
| 49 |
.\" |
.\" |
| 50 |
pages. |
pages. There is a syntax summary in the |
| 51 |
|
.\" HREF |
| 52 |
|
\fBpcresyntax\fR |
| 53 |
|
.\" |
| 54 |
|
page. |
| 55 |
.P |
.P |
| 56 |
Some features of PCRE can be included, excluded, or changed when the library is |
Some features of PCRE can be included, excluded, or changed when the library is |
| 57 |
built. The |
built. The |
| 85 |
follows: |
follows: |
| 86 |
.sp |
.sp |
| 87 |
pcre this document |
pcre this document |
| 88 |
|
pcre-config show PCRE installation configuration information |
| 89 |
pcreapi details of PCRE's native C API |
pcreapi details of PCRE's native C API |
| 90 |
pcrebuild options for building PCRE |
pcrebuild options for building PCRE |
| 91 |
pcrecallout details of the callout feature |
pcrecallout details of the callout feature |
| 97 |
.\" JOIN |
.\" JOIN |
| 98 |
pcrepattern syntax and semantics of supported |
pcrepattern syntax and semantics of supported |
| 99 |
regular expressions |
regular expressions |
| 100 |
|
pcresyntax quick syntax reference |
| 101 |
pcreperform discussion of performance issues |
pcreperform discussion of performance issues |
| 102 |
pcreposix the POSIX-compatible C API |
pcreposix the POSIX-compatible C API |
| 103 |
pcreprecompile details of saving and re-using precompiled patterns |
pcreprecompile details of saving and re-using precompiled patterns |
| 126 |
documentation for details). In these cases the limit is substantially larger. |
documentation for details). In these cases the limit is substantially larger. |
| 127 |
However, the speed of execution is slower. |
However, the speed of execution is slower. |
| 128 |
.P |
.P |
| 129 |
All values in repeating quantifiers must be less than 65536. The maximum |
All values in repeating quantifiers must be less than 65536. |
|
compiled length of subpattern with an explicit repeat count is 30000 bytes. The |
|
|
maximum number of capturing subpatterns is 65535. |
|
| 130 |
.P |
.P |
| 131 |
There is no limit to the number of parenthesized subpatterns, but there can be |
There is no limit to the number of parenthesized subpatterns, but there can be |
| 132 |
no more than 65535 capturing subpatterns. |
no more than 65535 capturing subpatterns. |
| 186 |
The following comments apply when PCRE is running in UTF-8 mode: |
The following comments apply when PCRE is running in UTF-8 mode: |
| 187 |
.P |
.P |
| 188 |
1. When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects |
1. When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects |
| 189 |
are checked for validity on entry to the relevant functions. If an invalid |
are checked for validity on entry to the relevant functions. Note that the |
| 190 |
UTF-8 string is passed, an error return is given. In some situations, you may |
check is for a syntactically valid UTF-8 byte string, as defined by RFC 2279. |
| 191 |
already know that your strings are valid, and therefore want to skip these |
It is \fInot\fP a check for a UTF-8 string of assigned or allowable Unicode |
| 192 |
checks in order to improve performance. If you set the PCRE_NO_UTF8_CHECK flag |
code points. For example, the byte sequence \exED\exB2\ex94 is a valid UTF-8 |
| 193 |
at compile time or at run time, PCRE assumes that the pattern or subject it |
encoding of the code point U+DC94, and is not rejected by PCRE. However, that |
| 194 |
is given (respectively) contains only valid UTF-8 codes. In this case, it does |
code point is in the "Low Surrogate Area" of Unicode, of which the Unicode |
| 195 |
not diagnose an invalid UTF-8 string. If you pass an invalid UTF-8 string to |
Standard says this: "The Low Surrogate Area does not contain any character |
| 196 |
PCRE when PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program |
assignments, consequently no character code charts or namelists are provided |
| 197 |
may crash. |
for this area. Surrogates are reserved for use with UTF-16 and then must be |
| 198 |
|
used in pairs." |
| 199 |
|
.P |
| 200 |
|
The reason for the UTF-8 check at the start is so that the rest of PCRE can |
| 201 |
|
assume that UTF-8 strings are well formed. There is no intention of |
| 202 |
|
interpreting the values of the code points, which would involve more processing |
| 203 |
|
and affect performance. |
| 204 |
|
.P |
| 205 |
|
If a syntactically invalid UTF-8 string is passed, an error return is given. In |
| 206 |
|
some situations, you may already know that your strings are valid, and |
| 207 |
|
therefore want to skip these checks in order to improve performance. If you set |
| 208 |
|
the PCRE_NO_UTF8_CHECK flag at compile time or at run time, PCRE assumes that |
| 209 |
|
the pattern or subject it is given (respectively) contains only valid UTF-8 |
| 210 |
|
codes. In this case, it does not diagnose an invalid UTF-8 string. If you pass |
| 211 |
|
an invalid UTF-8 string to PCRE when PCRE_NO_UTF8_CHECK is set, the results are |
| 212 |
|
undefined. Your program may crash. |
| 213 |
.P |
.P |
| 214 |
2. An unbraced hexadecimal escape sequence (such as \exb3) matches a two-byte |
2. An unbraced hexadecimal escape sequence (such as \exb3) matches a two-byte |
| 215 |
UTF-8 character if the value is greater than 127. |
UTF-8 character if the value is greater than 127. |
| 237 |
8. Similarly, characters that match the POSIX named character classes are all |
8. Similarly, characters that match the POSIX named character classes are all |
| 238 |
low-valued characters. |
low-valued characters. |
| 239 |
.P |
.P |
| 240 |
9. Case-insensitive matching applies only to characters whose values are less |
9. However, the Perl 5.10 horizontal and vertical whitespace matching escapes |
| 241 |
|
(\eh, \eH, \ev, and \eV) do match all the appropriate Unicode characters. |
| 242 |
|
.P |
| 243 |
|
10. Case-insensitive matching applies only to characters whose values are less |
| 244 |
than 128, unless PCRE is built with Unicode property support. Even when Unicode |
than 128, unless PCRE is built with Unicode property support. Even when Unicode |
| 245 |
property support is available, PCRE still uses its own character tables when |
property support is available, PCRE still uses its own character tables when |
| 246 |
checking the case of low-valued characters, so as not to degrade performance. |
checking the case of low-valued characters, so as not to degrade performance. |
| 250 |
letter's cases. There are a small number of many-to-one mappings in Unicode; |
letter's cases. There are a small number of many-to-one mappings in Unicode; |
| 251 |
these are not supported by PCRE. |
these are not supported by PCRE. |
| 252 |
. |
. |
| 253 |
|
. |
| 254 |
.SH AUTHOR |
.SH AUTHOR |
| 255 |
.rs |
.rs |
| 256 |
.sp |
.sp |
| 257 |
|
.nf |
| 258 |
Philip Hazel |
Philip Hazel |
| 259 |
.br |
University Computing Service |
|
University Computing Service, |
|
|
.br |
|
| 260 |
Cambridge CB2 3QH, England. |
Cambridge CB2 3QH, England. |
| 261 |
|
.fi |
| 262 |
.P |
.P |
| 263 |
Putting an actual email address here seems to have been a spam magnet, so I've |
Putting an actual email address here seems to have been a spam magnet, so I've |
| 264 |
taken it away. If you want to email me, use my initial and surname, separated |
taken it away. If you want to email me, use my two initials, followed by the |
| 265 |
by a dot, at the domain ucs.cam.ac.uk. |
two digits 10, at the domain cam.ac.uk. |
| 266 |
|
. |
| 267 |
|
. |
| 268 |
|
.SH REVISION |
| 269 |
|
.rs |
| 270 |
.sp |
.sp |
| 271 |
.in 0 |
.nf |
| 272 |
Last updated: 23 November 2006 |
Last updated: 07 August 2007 |
| 273 |
.br |
Copyright (c) 1997-2007 University of Cambridge. |
| 274 |
Copyright (c) 1997-2006 University of Cambridge. |
.fi |