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