1<html> 2<head> 3<title>pcrelimits specification</title> 4</head> 5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB"> 6<h1>pcrelimits man page</h1> 7<p> 8Return to the <a href="index.html">PCRE index page</a>. 9</p> 10<p> 11This page is part of the PCRE HTML documentation. It was generated automatically 12from the original man page. If there is any nonsense in it, please consult the 13man 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 PCRE but it is hoped that they will never in 20practice be relevant. 21</P> 22<P> 23The maximum length of a compiled pattern is approximately 64K data units (bytes 24for the 8-bit library, 16-bit units for the 16-bit library, and 32-bit units for 25the 32-bit library) if PCRE is compiled with the default internal linkage size, 26which is 2 bytes for the 8-bit and 16-bit libraries, and 4 bytes for the 32-bit 27library. If you want to process regular expressions that are truly enormous, 28you can compile PCRE with an internal linkage size of 3 or 4 (when building the 2916-bit or 32-bit library, 3 is rounded up to 4). See the <b>README</b> file in 30the source distribution and the 31<a href="pcrebuild.html"><b>pcrebuild</b></a> 32documentation for details. In these cases the limit is substantially larger. 33However, the speed of execution is slower. 34</P> 35<P> 36All values in repeating quantifiers must be less than 65536. 37</P> 38<P> 39There is no limit to the number of parenthesized subpatterns, but there can be 40no more than 65535 capturing subpatterns. There is, however, a limit to the 41depth of nesting of parenthesized subpatterns of all kinds. This is imposed in 42order to limit the amount of system stack used at compile time. The limit can 43be specified when PCRE is built; the default is 250. 44</P> 45<P> 46There is a limit to the number of forward references to subsequent subpatterns 47of around 200,000. Repeated forward references with fixed upper limits, for 48example, (?2){0,100} when subpattern number 2 is to the right, are included in 49the count. There is no limit to the number of backward references. 50</P> 51<P> 52The maximum length of name for a named subpattern is 32 characters, and the 53maximum number of named subpatterns is 10000. 54</P> 55<P> 56The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb 57is 255 for the 8-bit library and 65535 for the 16-bit and 32-bit libraries. 58</P> 59<P> 60The maximum length of a subject string is the largest positive number that an 61integer variable can hold. However, when using the traditional matching 62function, PCRE uses recursion to handle subpatterns and indefinite repetition. 63This means that the available stack space may limit the size of a subject 64string that can be processed by certain patterns. For a discussion of stack 65issues, see the 66<a href="pcrestack.html"><b>pcrestack</b></a> 67documentation. 68</P> 69<br><b> 70AUTHOR 71</b><br> 72<P> 73Philip Hazel 74<br> 75University Computing Service 76<br> 77Cambridge CB2 3QH, England. 78<br> 79</P> 80<br><b> 81REVISION 82</b><br> 83<P> 84Last updated: 05 November 2013 85<br> 86Copyright © 1997-2013 University of Cambridge. 87<br> 88<p> 89Return to the <a href="index.html">PCRE index page</a>. 90</p> 91