github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.7 KiB

  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>
  8. Return to the <a href="index.html">PCRE2 index page</a>.
  9. </p>
  10. <p>
  11. This page is part of the PCRE2 HTML documentation. It was generated
  12. automatically from the original man page. If there is any nonsense in it,
  13. please consult the man page, in case the conversion went wrong.
  14. <br>
  15. <br><b>
  16. SIZE AND OTHER LIMITATIONS
  17. </b><br>
  18. <P>
  19. There are some size limitations in PCRE2 but it is hoped that they will never
  20. in practice be relevant.
  21. </P>
  22. <P>
  23. The maximum size of a compiled pattern is approximately 64 thousand code units
  24. for the 8-bit and 16-bit libraries if PCRE2 is compiled with the default
  25. internal linkage size, which is 2 bytes for these libraries. If you want to
  26. process regular expressions that are truly enormous, you can compile PCRE2 with
  27. an internal linkage size of 3 or 4 (when building the 16-bit library, 3 is
  28. rounded up to 4). See the <b>README</b> file in the source distribution and the
  29. <a href="pcre2build.html"><b>pcre2build</b></a>
  30. documentation for details. In these cases the limit is substantially larger.
  31. However, the speed of execution is slower. In the 32-bit library, the internal
  32. linkage size is always 4.
  33. </P>
  34. <P>
  35. The maximum length of a source pattern string is essentially unlimited; it is
  36. the largest number a PCRE2_SIZE variable can hold. However, the program that
  37. calls <b>pcre2_compile()</b> can specify a smaller limit.
  38. </P>
  39. <P>
  40. The maximum length (in code units) of a subject string is one less than the
  41. largest number a PCRE2_SIZE variable can hold. PCRE2_SIZE is an unsigned
  42. integer 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
  44. and unset offsets.
  45. </P>
  46. <P>
  47. All values in repeating quantifiers must be less than 65536.
  48. </P>
  49. <P>
  50. There are two different limits that apply to branches of lookbehind assertions.
  51. If every branch in such an assertion matches a fixed number of characters,
  52. the maximum length of any branch is 65535 characters. If any branch matches a
  53. variable number of characters, then the maximum matching length for every
  54. branch is limited. The default limit is set at compile time, defaulting to 255,
  55. but can be changed by the calling program.
  56. </P>
  57. <P>
  58. There is no limit to the number of parenthesized groups, but there can be no
  59. more than 65535 capture groups, and there is a limit to the depth of nesting of
  60. parenthesized subpatterns of all kinds. This is imposed in order to limit the
  61. amount of system stack used at compile time. The default limit can be specified
  62. when PCRE2 is built; if not, the default is set to 250. An application can
  63. change this limit by calling pcre2_set_parens_nest_limit() to set the limit in
  64. a compile context.
  65. </P>
  66. <P>
  67. The maximum length of name for a named capture group is 32 code units, and the
  68. maximum number of such groups is 10000.
  69. </P>
  70. <P>
  71. The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb
  72. is 255 code units for the 8-bit library and 65535 code units for the 16-bit and
  73. 32-bit libraries.
  74. </P>
  75. <P>
  76. The maximum length of a string argument to a callout is the largest number a
  77. 32-bit unsigned integer can hold.
  78. </P>
  79. <P>
  80. The maximum amount of heap memory used for matching is controlled by the heap
  81. limit, which can be set in a pattern or in a match context. The default is a
  82. very large number, effectively unlimited.
  83. </P>
  84. <br><b>
  85. AUTHOR
  86. </b><br>
  87. <P>
  88. Philip Hazel
  89. <br>
  90. Retired from University Computing Service
  91. <br>
  92. Cambridge, England.
  93. <br>
  94. </P>
  95. <br><b>
  96. REVISION
  97. </b><br>
  98. <P>
  99. Last updated: August 2023
  100. <br>
  101. Copyright &copy; 1997-2023 University of Cambridge.
  102. <br>
  103. <p>
  104. Return to the <a href="index.html">PCRE2 index page</a>.
  105. </p>