1PCRELIMITS(3) Library Functions Manual PCRELIMITS(3)
2
3
4
6 PCRE - Perl-compatible regular expressions
7
9
10 There are some size limitations in PCRE but it is hoped that they will
11 never in practice be relevant.
12
13 The maximum length of a compiled pattern is approximately 64K data
14 units (bytes for the 8-bit library, 16-bit units for the 16-bit
15 library, and 32-bit units for the 32-bit library) if PCRE is compiled
16 with the default internal linkage size, which is 2 bytes for the 8-bit
17 and 16-bit libraries, and 4 bytes for the 32-bit library. If you want
18 to process regular expressions that are truly enormous, you can compile
19 PCRE with an internal linkage size of 3 or 4 (when building the 16-bit
20 or 32-bit library, 3 is rounded up to 4). See the README file in the
21 source distribution and the pcrebuild documentation for details. In
22 these cases the limit is substantially larger. However, the speed of
23 execution is slower.
24
25 All values in repeating quantifiers must be less than 65536.
26
27 There is no limit to the number of parenthesized subpatterns, but there
28 can be no more than 65535 capturing subpatterns. There is, however, a
29 limit to the depth of nesting of parenthesized subpatterns of all
30 kinds. This is imposed in order to limit the amount of system stack
31 used at compile time. The limit can be specified when PCRE is built;
32 the default is 250.
33
34 There is a limit to the number of forward references to subsequent sub‐
35 patterns of around 200,000. Repeated forward references with fixed
36 upper limits, for example, (?2){0,100} when subpattern number 2 is to
37 the right, are included in the count. There is no limit to the number
38 of backward references.
39
40 The maximum length of name for a named subpattern is 32 characters, and
41 the maximum number of named subpatterns is 10000.
42
43 The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or
44 (*THEN) verb is 255 for the 8-bit library and 65535 for the 16-bit and
45 32-bit libraries.
46
47 The maximum length of a subject string is the largest positive number
48 that an integer variable can hold. However, when using the traditional
49 matching function, PCRE uses recursion to handle subpatterns and indef‐
50 inite repetition. This means that the available stack space may limit
51 the size of a subject string that can be processed by certain patterns.
52 For a discussion of stack issues, see the pcrestack documentation.
53
55
56 Philip Hazel
57 University Computing Service
58 Cambridge CB2 3QH, England.
59
61
62 Last updated: 05 November 2013
63 Copyright (c) 1997-2013 University of Cambridge.
64
65
66
67PCRE 8.34 05 November 2013 PCRELIMITS(3)