1<html> 2<head> 3<title>pcre2limits specification</title> 4</head> 5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB"> 6<h1>pcre2limits man page</h1> 7<p> 8Return to the <a href="index.html">PCRE2 index page</a>. 9</p> 10<p> 11This page is part of the PCRE2 HTML documentation. It was generated 12automatically from the original man page. If there is any nonsense in it, 13please consult the man page, in case the conversion went wrong. 14<br> 15<br><b> 16SIZE AND OTHER LIMITATIONS 17</b><br> 18<P> 19There are some size limitations in PCRE2 but it is hoped that they will never 20in practice be relevant. 21</P> 22<P> 23The maximum size of a compiled pattern is approximately 64 thousand code units 24for the 8-bit and 16-bit libraries if PCRE2 is compiled with the default 25internal linkage size, which is 2 bytes for these libraries. If you want to 26process regular expressions that are truly enormous, you can compile PCRE2 with 27an internal linkage size of 3 or 4 (when building the 16-bit library, 3 is 28rounded up to 4). See the <b>README</b> file in the source distribution and the 29<a href="pcre2build.html"><b>pcre2build</b></a> 30documentation for details. In these cases the limit is substantially larger. 31However, the speed of execution is slower. In the 32-bit library, the internal 32linkage size is always 4. 33</P> 34<P> 35The maximum length of a source pattern string is essentially unlimited; it is 36the largest number a PCRE2_SIZE variable can hold. However, the program that 37calls <b>pcre2_compile()</b> can specify a smaller limit. 38</P> 39<P> 40The maximum length (in code units) of a subject string is one less than the 41largest number a PCRE2_SIZE variable can hold. PCRE2_SIZE is an unsigned 42integer type, usually defined as size_t. Its maximum value (that is 43~(PCRE2_SIZE)0) is reserved as a special indicator for zero-terminated strings 44and unset offsets. 45</P> 46<P> 47All values in repeating quantifiers must be less than 65536. 48</P> 49<P> 50The maximum length of a lookbehind assertion is 65535 characters. 51</P> 52<P> 53There is no limit to the number of parenthesized subpatterns, but there can be 54no more than 65535 capturing subpatterns. There is, however, a limit to the 55depth of nesting of parenthesized subpatterns of all kinds. This is imposed in 56order to limit the amount of system stack used at compile time. The default 57limit can be specified when PCRE2 is built; if not, the default is set to 250. 58An application can change this limit by calling pcre2_set_parens_nest_limit() 59to set the limit in a compile context. 60</P> 61<P> 62The maximum length of name for a named subpattern is 32 code units, and the 63maximum number of named subpatterns is 10000. 64</P> 65<P> 66The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb 67is 255 code units for the 8-bit library and 65535 code units for the 16-bit and 6832-bit libraries. 69</P> 70<P> 71The maximum length of a string argument to a callout is the largest number a 7232-bit unsigned integer can hold. 73</P> 74<br><b> 75AUTHOR 76</b><br> 77<P> 78Philip Hazel 79<br> 80University Computing Service 81<br> 82Cambridge, England. 83<br> 84</P> 85<br><b> 86REVISION 87</b><br> 88<P> 89Last updated: 30 March 2017 90<br> 91Copyright © 1997-2017 University of Cambridge. 92<br> 93<p> 94Return to the <a href="index.html">PCRE2 index page</a>. 95</p> 96