/[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 75 by nigel, Sat Feb 24 21:40:37 2007 UTC revision 99 by ph10, Tue Mar 6 12:27:42 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 5.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.)
11  Unicode general category properties. However, this support has to be explicitly  .P
12  enabled; it is not the default.  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
20    different way. In certain circumstances, the alternative function has some
21    advantages. For a discussion of the two matching algorithms, see the
22    .\" HREF
23    \fBpcrematching\fP
24    .\"
25    page.
26  .P  .P
27  PCRE is written in C and released as a C library. A number of people have  PCRE is written in C and released as a C library. A number of people have
28  written wrappers and interfaces of various kinds. A C++ class is included in  written wrappers and interfaces of various kinds. In particular, Google Inc.
29  these contributions, which can be found in the \fIContrib\fR directory at the  have provided a comprehensive C++ wrapper. This is now included as part of the
30  primary FTP site, which is:  PCRE distribution. The
31    .\" HREF
32    \fBpcrecpp\fP
33    .\"
34    page has details of this interface. Other people's contributions can be found
35    in the \fIContrib\fR directory at the primary FTP site, which is:
36  .sp  .sp
37  .\" HTML <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">  .\" HTML <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">
38  .\" </a>  .\" </a>
# Line 43  available. The features themselves are d Line 61  available. The features themselves are d
61  .\"  .\"
62  page. Documentation about building PCRE for various operating systems can be  page. Documentation about building PCRE for various operating systems can be
63  found in the \fBREADME\fP file in the source distribution.  found in the \fBREADME\fP file in the source distribution.
64    .P
65    The library contains a number of undocumented internal functions and data
66    tables that are used by more than one of the exported external functions, but
67    which are not intended for use by external callers. Their names all begin with
68    "_pcre_", which hopefully will not provoke any name clashes. In some
69    environments, it is possible to control which external symbols are exported
70    when a shared library is built, and in these cases the undocumented symbols are
71    not exported.
72  .  .
73  .  .
74  .SH "USER DOCUMENTATION"  .SH "USER DOCUMENTATION"
# Line 55  all the sections are concatenated, for e Line 81  all the sections are concatenated, for e
81  follows:  follows:
82  .sp  .sp
83    pcre              this document    pcre              this document
84    pcreapi           details of PCRE's native API    pcreapi           details of PCRE's native C API
85    pcrebuild         options for building PCRE    pcrebuild         options for building PCRE
86    pcrecallout       details of the callout feature    pcrecallout       details of the callout feature
87    pcrecompat        discussion of Perl compatibility    pcrecompat        discussion of Perl compatibility
88      pcrecpp           details of the C++ wrapper
89    pcregrep          description of the \fBpcregrep\fP command    pcregrep          description of the \fBpcregrep\fP command
90      pcrematching      discussion of the two matching algorithms
91    pcrepartial       details of the partial matching facility    pcrepartial       details of the partial matching facility
92  .\" JOIN  .\" JOIN
93    pcrepattern       syntax and semantics of supported    pcrepattern       syntax and semantics of supported
94                        regular expressions                        regular expressions
95    pcreperform       discussion of performance issues    pcreperform       discussion of performance issues
96    pcreposix         the POSIX-compatible API    pcreposix         the POSIX-compatible C API
97    pcreprecompile    details of saving and re-using precompiled patterns    pcreprecompile    details of saving and re-using precompiled patterns
98    pcresample        discussion of the sample program    pcresample        discussion of the sample program
99      pcrestack         discussion of stack usage
100    pcretest          description of the \fBpcretest\fP testing command    pcretest          description of the \fBpcretest\fP testing command
101  .sp  .sp
102  In addition, in the "man" and HTML formats, there is a short page for each  In addition, in the "man" and HTML formats, there is a short page for each
103  library function, listing its arguments and results.  C library function, listing its arguments and results.
104  .  .
105  .  .
106  .SH LIMITATIONS  .SH LIMITATIONS
# Line 89  distribution and the Line 118  distribution and the
118  \fBpcrebuild\fP  \fBpcrebuild\fP
119  .\"  .\"
120  documentation for details). In these cases the limit is substantially larger.  documentation for details). In these cases the limit is substantially larger.
121  However, the speed of execution will be slower.  However, the speed of execution is slower.
122    .P
123    All values in repeating quantifiers must be less than 65536. The maximum
124    compiled length of subpattern with an explicit repeat count is 30000 bytes. The
125    maximum number of capturing subpatterns is 65535.
126  .P  .P
127  All values in repeating quantifiers must be less than 65536.  There is no limit to the number of parenthesized subpatterns, but there can be
128  The maximum number of capturing subpatterns is 65535.  no more than 65535 capturing subpatterns.
129  .P  .P
130  There is no limit to the number of non-capturing subpatterns, but the maximum  The maximum length of name for a named subpattern is 32 characters, and the
131  depth of nesting of all kinds of parenthesized subpattern, including capturing  maximum number of named subpatterns is 10000.
 subpatterns, assertions, and other types of subpattern, is 200.  
132  .P  .P
133  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
134  integer variable can hold. However, PCRE uses recursion to handle subpatterns  integer variable can hold. However, when using the traditional matching
135  and indefinite repetition. This means that the available stack space may limit  function, PCRE uses recursion to handle subpatterns and indefinite repetition.
136  the size of a subject string that can be processed by certain patterns.  This means that the available stack space may limit the size of a subject
137    string that can be processed by certain patterns. For a discussion of stack
138    issues, see the
139    .\" HREF
140    \fBpcrestack\fP
141    .\"
142    documentation.
143  .sp  .sp
144  .\" HTML <a name="utf8support"></a>  .\" HTML <a name="utf8support"></a>
145  .  .
# Line 125  instead of just strings of bytes. Line 163  instead of just strings of bytes.
163  .P  .P
164  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
165  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
166  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.
167  .P  .P
168  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
169  support), the escape sequences \ep{..}, \eP{..}, and \eX are supported.  support), the escape sequences \ep{..}, \eP{..}, and \eX are supported.
170  The available properties that can be tested are limited to the general  The available properties that can be tested are limited to the general
171  category properties such as Lu for an upper case letter or Nd for a decimal  category properties such as Lu for an upper case letter or Nd for a decimal
172  number. A full list is given in the  number, the Unicode script names such as Arabic or Han, and the derived
173    properties Any and L&. A full list is given in the
174  .\" HREF  .\" HREF
175  \fBpcrepattern\fP  \fBpcrepattern\fP
176  .\"  .\"
177  documentation. The PCRE library is increased in size by about 90K when Unicode  documentation. Only the short names for properties are supported. For example,
178  property support is included.  \ep{L} matches a letter. Its Perl synonym, \ep{Letter}, is not supported.
179    Furthermore, in Perl, many properties may optionally be prefixed by "Is", for
180    compatibility with Perl 5.6. PCRE does not support this.
181  .P  .P
182  The following comments apply when PCRE is running in UTF-8 mode:  The following comments apply when PCRE is running in UTF-8 mode:
183  .P  .P
# Line 151  not diagnose an invalid UTF-8 string. If Line 192  not diagnose an invalid UTF-8 string. If
192  PCRE when PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program  PCRE when PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program
193  may crash.  may crash.
194  .P  .P
195  2. In a pattern, the escape sequence \ex{...}, where the contents of the braces  2. An unbraced hexadecimal escape sequence (such as \exb3) matches a two-byte
196  is a string of hexadecimal digits, is interpreted as a UTF-8 character whose  UTF-8 character if the value is greater than 127.
 code number is the given hexadecimal number, for example: \ex{1234}. If a  
 non-hexadecimal digit appears between the braces, the item is not recognized.  
 This escape sequence can be used either as a literal, or within a character  
 class.  
197  .P  .P
198  3. The original hexadecimal escape sequence, \exhh, matches a two-byte UTF-8  3. Octal numbers up to \e777 are recognized, and match two-byte UTF-8
199  character if the value is greater than 127.  characters for values greater than \e177.
200  .P  .P
201  4. Repeat quantifiers apply to complete UTF-8 characters, not to individual  4. Repeat quantifiers apply to complete UTF-8 characters, not to individual
202  bytes, for example: \ex{100}{3}.  bytes, for example: \ex{100}{3}.
# Line 167  bytes, for example: \ex{100}{3}. Line 204  bytes, for example: \ex{100}{3}.
204  5. The dot metacharacter matches one UTF-8 character instead of a single byte.  5. The dot metacharacter matches one UTF-8 character instead of a single byte.
205  .P  .P
206  6. The escape sequence \eC can be used to match a single byte in UTF-8 mode,  6. The escape sequence \eC can be used to match a single byte in UTF-8 mode,
207  but its use can lead to some strange effects.  but its use can lead to some strange effects. This facility is not available in
208    the alternative matching function, \fBpcre_dfa_exec()\fP.
209  .P  .P
210  7. The character escapes \eb, \eB, \ed, \eD, \es, \eS, \ew, and \eW correctly  7. The character escapes \eb, \eB, \ed, \eD, \es, \eS, \ew, and \eW correctly
211  test characters of any code value, but the characters that PCRE recognizes as  test characters of any code value, but the characters that PCRE recognizes as
# Line 185  than 128, unless PCRE is built with Unic Line 223  than 128, unless PCRE is built with Unic
223  property support is available, PCRE still uses its own character tables when  property support is available, PCRE still uses its own character tables when
224  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.
225  The Unicode property information is used only for characters with higher  The Unicode property information is used only for characters with higher
226  values.  values. Even when Unicode property support is available, PCRE supports
227    case-insensitive matching only when there is a one-to-one mapping between a
228    letter's cases. There are a small number of many-to-one mappings in Unicode;
229    these are not supported by PCRE.
230    .
231  .  .
232  .SH AUTHOR  .SH AUTHOR
233  .rs  .rs
234  .sp  .sp
235  Philip Hazel <ph10@cam.ac.uk>  .nf
236  .br  Philip Hazel
237  University Computing Service,  University Computing Service
238  .br  Cambridge CB2 3QH, England.
239  Cambridge CB2 3QG, England.  .fi
240  .br  .P
241  Phone: +44 1223 334714  Putting an actual email address here seems to have been a spam magnet, so I've
242  .sp  taken it away. If you want to email me, use my initial and surname, separated
243  .in 0  by a dot, at the domain ucs.cam.ac.uk.
244  Last updated: 09 September 2004  .
245  .br  .
246  Copyright (c) 1997-2004 University of Cambridge.  .SH REVISION
247    .rs
248    .sp
249    .nf
250    Last updated: 06 March 2007
251    Copyright (c) 1997-2007 University of Cambridge.
252    .fi

Legend:
Removed from v.75  
changed lines
  Added in v.99

  ViewVC Help
Powered by ViewVC 1.1.5