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