| 1 |
.TH PCRELIMITS 3 "04 May 2012" "PCRE 8.30"
|
| 2 |
.SH NAME
|
| 3 |
PCRE - Perl-compatible regular expressions
|
| 4 |
.SH "SIZE AND OTHER LIMITATIONS"
|
| 5 |
.rs
|
| 6 |
.sp
|
| 7 |
There are some size limitations in PCRE but it is hoped that they will never in
|
| 8 |
practice be relevant.
|
| 9 |
.P
|
| 10 |
The maximum length of a compiled pattern is approximately 64K data units (bytes
|
| 11 |
for the 8-bit library, 16-bit units for the 16-bit library) if PCRE is compiled
|
| 12 |
with the default internal linkage size of 2 bytes. If you want to process
|
| 13 |
regular expressions that are truly enormous, you can compile PCRE with an
|
| 14 |
internal linkage size of 3 or 4 (when building the 16-bit library, 3 is rounded
|
| 15 |
up to 4). See the \fBREADME\fP file in the source distribution and the
|
| 16 |
.\" HREF
|
| 17 |
\fBpcrebuild\fP
|
| 18 |
.\"
|
| 19 |
documentation for details. In these cases the limit is substantially larger.
|
| 20 |
However, the speed of execution is slower.
|
| 21 |
.P
|
| 22 |
All values in repeating quantifiers must be less than 65536.
|
| 23 |
.P
|
| 24 |
There is no limit to the number of parenthesized subpatterns, but there can be
|
| 25 |
no more than 65535 capturing subpatterns.
|
| 26 |
.P
|
| 27 |
There is a limit to the number of forward references to subsequent subpatterns
|
| 28 |
of around 200,000. Repeated forward references with fixed upper limits, for
|
| 29 |
example, (?2){0,100} when subpattern number 2 is to the right, are included in
|
| 30 |
the count. There is no limit to the number of backward references.
|
| 31 |
.P
|
| 32 |
The maximum length of name for a named subpattern is 32 characters, and the
|
| 33 |
maximum number of named subpatterns is 10000.
|
| 34 |
.P
|
| 35 |
The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb
|
| 36 |
is 255 for the 8-bit library and 65535 for the 16-bit library.
|
| 37 |
.P
|
| 38 |
The maximum length of a subject string is the largest positive number that an
|
| 39 |
integer variable can hold. However, when using the traditional matching
|
| 40 |
function, PCRE uses recursion to handle subpatterns and indefinite repetition.
|
| 41 |
This means that the available stack space may limit the size of a subject
|
| 42 |
string that can be processed by certain patterns. For a discussion of stack
|
| 43 |
issues, see the
|
| 44 |
.\" HREF
|
| 45 |
\fBpcrestack\fP
|
| 46 |
.\"
|
| 47 |
documentation.
|
| 48 |
.
|
| 49 |
.
|
| 50 |
.SH AUTHOR
|
| 51 |
.rs
|
| 52 |
.sp
|
| 53 |
.nf
|
| 54 |
Philip Hazel
|
| 55 |
University Computing Service
|
| 56 |
Cambridge CB2 3QH, England.
|
| 57 |
.fi
|
| 58 |
.
|
| 59 |
.
|
| 60 |
.SH REVISION
|
| 61 |
.rs
|
| 62 |
.sp
|
| 63 |
.nf
|
| 64 |
Last updated: 04 May 2012
|
| 65 |
Copyright (c) 1997-2012 University of Cambridge.
|
| 66 |
.fi
|