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.

81 lines
3.2 KiB

  1. .TH PCRE2LIMITS 3 "1 August 2023" "PCRE2 10.43"
  2. .SH NAME
  3. PCRE2 - Perl-compatible regular expressions (revised API)
  4. .SH "SIZE AND OTHER LIMITATIONS"
  5. .rs
  6. .sp
  7. There are some size limitations in PCRE2 but it is hoped that they will never
  8. in practice be relevant.
  9. .P
  10. The maximum size of a compiled pattern is approximately 64 thousand code units
  11. for the 8-bit and 16-bit libraries if PCRE2 is compiled with the default
  12. internal linkage size, which is 2 bytes for these libraries. If you want to
  13. process regular expressions that are truly enormous, you can compile PCRE2 with
  14. an internal linkage size of 3 or 4 (when building the 16-bit library, 3 is
  15. rounded up to 4). See the \fBREADME\fP file in the source distribution and the
  16. .\" HREF
  17. \fBpcre2build\fP
  18. .\"
  19. documentation for details. In these cases the limit is substantially larger.
  20. However, the speed of execution is slower. In the 32-bit library, the internal
  21. linkage size is always 4.
  22. .P
  23. The maximum length of a source pattern string is essentially unlimited; it is
  24. the largest number a PCRE2_SIZE variable can hold. However, the program that
  25. calls \fBpcre2_compile()\fP can specify a smaller limit.
  26. .P
  27. The maximum length (in code units) of a subject string is one less than the
  28. largest number a PCRE2_SIZE variable can hold. PCRE2_SIZE is an unsigned
  29. integer type, usually defined as size_t. Its maximum value (that is
  30. ~(PCRE2_SIZE)0) is reserved as a special indicator for zero-terminated strings
  31. and unset offsets.
  32. .P
  33. All values in repeating quantifiers must be less than 65536.
  34. .P
  35. There are two different limits that apply to branches of lookbehind assertions.
  36. If every branch in such an assertion matches a fixed number of characters,
  37. the maximum length of any branch is 65535 characters. If any branch matches a
  38. variable number of characters, then the maximum matching length for every
  39. branch is limited. The default limit is set at compile time, defaulting to 255,
  40. but can be changed by the calling program.
  41. .P
  42. There is no limit to the number of parenthesized groups, but there can be no
  43. more than 65535 capture groups, and there is a limit to the depth of nesting of
  44. parenthesized subpatterns of all kinds. This is imposed in order to limit the
  45. amount of system stack used at compile time. The default limit can be specified
  46. when PCRE2 is built; if not, the default is set to 250. An application can
  47. change this limit by calling pcre2_set_parens_nest_limit() to set the limit in
  48. a compile context.
  49. .P
  50. The maximum length of name for a named capture group is 32 code units, and the
  51. maximum number of such groups is 10000.
  52. .P
  53. The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb
  54. is 255 code units for the 8-bit library and 65535 code units for the 16-bit and
  55. 32-bit libraries.
  56. .P
  57. The maximum length of a string argument to a callout is the largest number a
  58. 32-bit unsigned integer can hold.
  59. .P
  60. The maximum amount of heap memory used for matching is controlled by the heap
  61. limit, which can be set in a pattern or in a match context. The default is a
  62. very large number, effectively unlimited.
  63. .
  64. .
  65. .SH AUTHOR
  66. .rs
  67. .sp
  68. .nf
  69. Philip Hazel
  70. Retired from University Computing Service
  71. Cambridge, England.
  72. .fi
  73. .
  74. .
  75. .SH REVISION
  76. .rs
  77. .sp
  78. .nf
  79. Last updated: August 2023
  80. Copyright (c) 1997-2023 University of Cambridge.
  81. .fi