1PCRE2LIMITS(3)             Library Functions Manual             PCRE2LIMITS(3)
2
3
4

NAME

6       PCRE2 - Perl-compatible regular expressions (revised API)
7

SIZE AND OTHER LIMITATIONS

9
10       There are some size limitations in PCRE2 but it is hoped that they will
11       never in practice be relevant.
12
13       The maximum size of a compiled pattern  is  approximately  64  thousand
14       code units for the 8-bit and 16-bit libraries if PCRE2 is compiled with
15       the  default  internal  linkage  size,  which  is  2  bytes  for  these
16       libraries.  If  you  want to process regular expressions that are truly
17       enormous, you can compile PCRE2 with an internal linkage size of 3 or 4
18       (when  building  the  16-bit  library,  3  is rounded up to 4). See the
19       README file in the source distribution and the pcre2build documentation
20       for  details.  In  these cases the limit is substantially larger.  How‐
21       ever, the speed of execution is slower.  In  the  32-bit  library,  the
22       internal linkage size is always 4.
23
24       The maximum length of a source pattern string is essentially unlimited;
25       it is the largest number a PCRE2_SIZE variable can hold.  However,  the
26       program that calls pcre2_compile() can specify a smaller limit.
27
28       The maximum length (in code units) of a subject string is one less than
29       the largest number a PCRE2_SIZE variable can  hold.  PCRE2_SIZE  is  an
30       unsigned  integer  type,  usually  defined as size_t. Its maximum value
31       (that is ~(PCRE2_SIZE)0) is reserved as a special indicator  for  zero-
32       terminated strings and unset offsets.
33
34       All values in repeating quantifiers must be less than 65536.
35
36       The maximum length of a lookbehind assertion is 65535 characters.
37
38       There is no limit to the number of parenthesized subpatterns, but there
39       can be no more than 65535 capturing subpatterns. There is,  however,  a
40       limit  to  the  depth  of  nesting  of parenthesized subpatterns of all
41       kinds. This is imposed in order to limit the  amount  of  system  stack
42       used  at compile time. The default limit can be specified when PCRE2 is
43       built; if not, the default is set to 250.  An  application  can  change
44       this limit by calling pcre2_set_parens_nest_limit() to set the limit in
45       a compile context.
46
47       The maximum length of name for a named subpattern is 32 code units, and
48       the maximum number of named subpatterns is 10000.
49
50       The  maximum  length  of  a  name  in  a (*MARK), (*PRUNE), (*SKIP), or
51       (*THEN) verb is 255 code units for the 8-bit  library  and  65535  code
52       units for the 16-bit and 32-bit libraries.
53
54       The  maximum  length  of  a string argument to a callout is the largest
55       number a 32-bit unsigned integer can hold.
56

AUTHOR

58
59       Philip Hazel
60       University Computing Service
61       Cambridge, England.
62

REVISION

64
65       Last updated: 30 March 2017
66       Copyright (c) 1997-2017 University of Cambridge.
67
68
69
70PCRE2 10.30                      30 March 2017                  PCRE2LIMITS(3)
Impressum