pcre2limits.3 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .TH PCRE2LIMITS 3 "03 February 2019" "PCRE2 10.33"
  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. The maximum length of a lookbehind assertion is 65535 characters.
  36. .P
  37. There is no limit to the number of parenthesized groups, but there can be no
  38. more than 65535 capture groups, and there is a limit to the depth of nesting of
  39. parenthesized subpatterns of all kinds. This is imposed in order to limit the
  40. amount of system stack used at compile time. The default limit can be specified
  41. when PCRE2 is built; if not, the default is set to 250. An application can
  42. change this limit by calling pcre2_set_parens_nest_limit() to set the limit in
  43. a compile context.
  44. .P
  45. The maximum length of name for a named capture group is 32 code units, and the
  46. maximum number of such groups is 10000.
  47. .P
  48. The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb
  49. is 255 code units for the 8-bit library and 65535 code units for the 16-bit and
  50. 32-bit libraries.
  51. .P
  52. The maximum length of a string argument to a callout is the largest number a
  53. 32-bit unsigned integer can hold.
  54. .
  55. .
  56. .SH AUTHOR
  57. .rs
  58. .sp
  59. .nf
  60. Philip Hazel
  61. University Computing Service
  62. Cambridge, England.
  63. .fi
  64. .
  65. .
  66. .SH REVISION
  67. .rs
  68. .sp
  69. .nf
  70. Last updated: 02 February 2019
  71. Copyright (c) 1997-2019 University of Cambridge.
  72. .fi