/[pcre]/code/trunk/doc/pcre.3
ViewVC logotype

Diff of /code/trunk/doc/pcre.3

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 91 by nigel, Sat Feb 24 21:41:34 2007 UTC revision 209 by ph10, Tue Aug 7 09:22:06 2007 UTC
# Line 6  PCRE - Perl-compatible regular expressio Line 6  PCRE - Perl-compatible regular expressio
6  .sp  .sp
7  The PCRE library is a set of functions that implement regular expression  The PCRE library is a set of functions that implement regular expression
8  pattern matching using the same syntax and semantics as Perl, with just a few  pattern matching using the same syntax and semantics as Perl, with just a few
9  differences. The current implementation of PCRE (release 6.x) corresponds  differences. (Certain features that appeared in Python and PCRE before they
10  approximately with Perl 5.8, including support for UTF-8 encoded strings and  appeared in Perl are also available using the Python syntax.)
 Unicode general category properties. However, this support has to be explicitly  
 enabled; it is not the default.  
11  .P  .P
12  In addition to the Perl-compatible matching function, PCRE also contains an  The current implementation of PCRE (release 7.x) corresponds approximately with
13    Perl 5.10, including support for UTF-8 encoded strings and Unicode general
14    category properties. However, UTF-8 and Unicode support has to be explicitly
15    enabled; it is not the default. The Unicode tables correspond to Unicode
16    release 5.0.0.
17    .P
18    In addition to the Perl-compatible matching function, PCRE contains an
19  alternative matching function that matches the same compiled patterns in a  alternative matching function that matches the same compiled patterns in a
20  different way. In certain circumstances, the alternative function has some  different way. In certain circumstances, the alternative function has some
21  advantages. For a discussion of the two matching algorithms, see the  advantages. For a discussion of the two matching algorithms, see the
# Line 43  and Line 47  and
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
# Line 77  all the sections are concatenated, for e Line 85  all the sections are concatenated, for e
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
# Line 88  follows: Line 97  follows:
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
# Line 114  distribution and the Line 124  distribution and the
124  \fBpcrebuild\fP  \fBpcrebuild\fP
125  .\"  .\"
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 will be slower.  However, the speed of execution is slower.
128    .P
129    All values in repeating quantifiers must be less than 65536.
130  .P  .P
131  All values in repeating quantifiers must be less than 65536. The maximum  There is no limit to the number of parenthesized subpatterns, but there can be
132  compiled length of subpattern with an explicit repeat count is 30000 bytes. The  no more than 65535 capturing subpatterns.
 maximum number of capturing subpatterns is 65535.  
 .P  
 There is no limit to the number of non-capturing subpatterns, but the maximum  
 depth of nesting of all kinds of parenthesized subpattern, including capturing  
 subpatterns, assertions, and other types of subpattern, is 200.  
133  .P  .P
134  The maximum length of name for a named subpattern is 32, and the maximum number  The maximum length of name for a named subpattern is 32 characters, and the
135  of named subpatterns is 10000.  maximum number of named subpatterns is 10000.
136  .P  .P
137  The maximum length of a subject string is the largest positive number that an  The maximum length of a subject string is the largest positive number that an
138  integer variable can hold. However, when using the traditional matching  integer variable can hold. However, when using the traditional matching
# Line 160  instead of just strings of bytes. Line 167  instead of just strings of bytes.
167  .P  .P
168  If you compile PCRE with UTF-8 support, but do not use it at run time, the  If you compile PCRE with UTF-8 support, but do not use it at run time, the
169  library will be a bit bigger, but the additional run time overhead is limited  library will be a bit bigger, but the additional run time overhead is limited
170  to testing the PCRE_UTF8 flag in several places, so should not be very large.  to testing the PCRE_UTF8 flag occasionally, so should not be very big.
171  .P  .P
172  If PCRE is built with Unicode character property support (which implies UTF-8  If PCRE is built with Unicode character property support (which implies UTF-8
173  support), the escape sequences \ep{..}, \eP{..}, and \eX are supported.  support), the escape sequences \ep{..}, \eP{..}, and \eX are supported.
# Line 179  compatibility with Perl 5.6. PCRE does n Line 186  compatibility with Perl 5.6. PCRE does n
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.
# Line 215  must use Unicode property tests such as Line 237  must use Unicode property tests such as
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.
# Line 225  case-insensitive matching only when ther Line 250  case-insensitive matching only when ther
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
260  University Computing Service,  Cambridge CB2 3QH, England.
261  .br  .fi
 Cambridge CB2 3QG, England.  
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: 05 June 2006  Last updated: 07 August 2007
273  .br  Copyright (c) 1997-2007 University of Cambridge.
274  Copyright (c) 1997-2006 University of Cambridge.  .fi

Legend:
Removed from v.91  
changed lines
  Added in v.209

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12