pcre2_pattern_info.3 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. .TH PCRE2_PATTERN_INFO 3 "14 February 2019" "PCRE2 10.33"
  2. .SH NAME
  3. PCRE2 - Perl-compatible regular expressions (revised API)
  4. .SH SYNOPSIS
  5. .rs
  6. .sp
  7. .B #include <pcre2.h>
  8. .PP
  9. .nf
  10. .B int pcre2_pattern_info(const pcre2_code *\fIcode\fP, uint32_t \fIwhat\fP,
  11. .B " void *\fIwhere\fP);"
  12. .fi
  13. .
  14. .SH DESCRIPTION
  15. .rs
  16. .sp
  17. This function returns information about a compiled pattern. Its arguments are:
  18. .sp
  19. \fIcode\fP Pointer to a compiled regular expression pattern
  20. \fIwhat\fP What information is required
  21. \fIwhere\fP Where to put the information
  22. .sp
  23. The recognized values for the \fIwhat\fP argument, and the information they
  24. request are as follows:
  25. .sp
  26. PCRE2_INFO_ALLOPTIONS Final options after compiling
  27. PCRE2_INFO_ARGOPTIONS Options passed to \fBpcre2_compile()\fP
  28. PCRE2_INFO_BACKREFMAX Number of highest backreference
  29. PCRE2_INFO_BSR What \eR matches:
  30. PCRE2_BSR_UNICODE: Unicode line endings
  31. PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only
  32. PCRE2_INFO_CAPTURECOUNT Number of capturing subpatterns
  33. .\" JOIN
  34. PCRE2_INFO_DEPTHLIMIT Backtracking depth limit if set,
  35. otherwise PCRE2_ERROR_UNSET
  36. PCRE2_INFO_EXTRAOPTIONS Extra options that were passed in the
  37. compile context
  38. PCRE2_INFO_FIRSTBITMAP Bitmap of first code units, or NULL
  39. PCRE2_INFO_FIRSTCODETYPE Type of start-of-match information
  40. 0 nothing set
  41. 1 first code unit is set
  42. 2 start of string or after newline
  43. PCRE2_INFO_FIRSTCODEUNIT First code unit when type is 1
  44. PCRE2_INFO_FRAMESIZE Size of backtracking frame
  45. PCRE2_INFO_HASBACKSLASHC Return 1 if pattern contains \eC
  46. .\" JOIN
  47. PCRE2_INFO_HASCRORLF Return 1 if explicit CR or LF matches
  48. exist in the pattern
  49. .\" JOIN
  50. PCRE2_INFO_HEAPLIMIT Heap memory limit if set,
  51. otherwise PCRE2_ERROR_UNSET
  52. PCRE2_INFO_JCHANGED Return 1 if (?J) or (?-J) was used
  53. PCRE2_INFO_JITSIZE Size of JIT compiled code, or 0
  54. PCRE2_INFO_LASTCODETYPE Type of must-be-present information
  55. 0 nothing set
  56. 1 code unit is set
  57. PCRE2_INFO_LASTCODEUNIT Last code unit when type is 1
  58. .\" JOIN
  59. PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an
  60. empty string, 0 otherwise
  61. .\" JOIN
  62. PCRE2_INFO_MATCHLIMIT Match limit if set,
  63. otherwise PCRE2_ERROR_UNSET
  64. .\" JOIN
  65. PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest
  66. lookbehind assertion
  67. PCRE2_INFO_MINLENGTH Lower bound length of matching strings
  68. PCRE2_INFO_NAMECOUNT Number of named subpatterns
  69. PCRE2_INFO_NAMEENTRYSIZE Size of name table entries
  70. PCRE2_INFO_NAMETABLE Pointer to name table
  71. PCRE2_CONFIG_NEWLINE Code for the newline sequence:
  72. PCRE2_NEWLINE_CR
  73. PCRE2_NEWLINE_LF
  74. PCRE2_NEWLINE_CRLF
  75. PCRE2_NEWLINE_ANY
  76. PCRE2_NEWLINE_ANYCRLF
  77. PCRE2_NEWLINE_NUL
  78. PCRE2_INFO_RECURSIONLIMIT Obsolete synonym for PCRE2_INFO_DEPTHLIMIT
  79. PCRE2_INFO_SIZE Size of compiled pattern
  80. .sp
  81. If \fIwhere\fP is NULL, the function returns the amount of memory needed for
  82. the requested information, in bytes. Otherwise, the \fIwhere\fP argument must
  83. point to an unsigned 32-bit integer (uint32_t variable), except for the
  84. following \fIwhat\fP values, when it must point to a variable of the type
  85. shown:
  86. .sp
  87. PCRE2_INFO_FIRSTBITMAP const uint8_t *
  88. PCRE2_INFO_JITSIZE size_t
  89. PCRE2_INFO_NAMETABLE PCRE2_SPTR
  90. PCRE2_INFO_SIZE size_t
  91. .sp
  92. The yield of the function is zero on success or:
  93. .sp
  94. PCRE2_ERROR_NULL the argument \fIcode\fP is NULL
  95. PCRE2_ERROR_BADMAGIC the "magic number" was not found
  96. PCRE2_ERROR_BADOPTION the value of \fIwhat\fP is invalid
  97. PCRE2_ERROR_BADMODE the pattern was compiled in the wrong mode
  98. PCRE2_ERROR_UNSET the requested information is not set
  99. .P
  100. There is a complete description of the PCRE2 native API in the
  101. .\" HREF
  102. \fBpcre2api\fP
  103. .\"
  104. page and a description of the POSIX API in the
  105. .\" HREF
  106. \fBpcre2posix\fP
  107. .\"
  108. page.