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 *code, uint32_t what,
13 void *where);
14
16
17 This function returns information about a compiled pattern. Its argu‐
18 ments are:
19
20 code Pointer to a compiled regular expression pattern
21 what What information is required
22 where Where to put the information
23
24 The recognized values for the what argument, and the information they
25 request are as follows:
26
27 PCRE2_INFO_ALLOPTIONS Final options after compiling
28 PCRE2_INFO_ARGOPTIONS Options passed to pcre2_compile()
29 PCRE2_INFO_BACKREFMAX Number of highest backreference
30 PCRE2_INFO_BSR What \R matches:
31 PCRE2_BSR_UNICODE: Unicode line endings
32 PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only
33 PCRE2_INFO_CAPTURECOUNT Number of capturing subpatterns
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 \C
46 PCRE2_INFO_HASCRORLF Return 1 if explicit CR or LF matches
47 exist in the pattern
48 PCRE2_INFO_HEAPLIMIT Heap memory limit if set,
49 otherwise PCRE2_ERROR_UNSET
50 PCRE2_INFO_JCHANGED Return 1 if (?J) or (?-J) was used
51 PCRE2_INFO_JITSIZE Size of JIT compiled code, or 0
52 PCRE2_INFO_LASTCODETYPE Type of must-be-present information
53 0 nothing set
54 1 code unit is set
55 PCRE2_INFO_LASTCODEUNIT Last code unit when type is 1
56 PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an
57 empty string, 0 otherwise
58 PCRE2_INFO_MATCHLIMIT Match limit if set,
59 otherwise PCRE2_ERROR_UNSET
60 PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest
61 lookbehind assertion
62 PCRE2_INFO_MINLENGTH Lower bound length of matching strings
63 PCRE2_INFO_NAMECOUNT Number of named subpatterns
64 PCRE2_INFO_NAMEENTRYSIZE Size of name table entries
65 PCRE2_INFO_NAMETABLE Pointer to name table
66 PCRE2_CONFIG_NEWLINE Code for the newline sequence:
67 PCRE2_NEWLINE_CR
68 PCRE2_NEWLINE_LF
69 PCRE2_NEWLINE_CRLF
70 PCRE2_NEWLINE_ANY
71 PCRE2_NEWLINE_ANYCRLF
72 PCRE2_NEWLINE_NUL
73 PCRE2_INFO_RECURSIONLIMIT Obsolete synonym for PCRE2_INFO_DEPTHLIMIT
74 PCRE2_INFO_SIZE Size of compiled pattern
75
76 If where is NULL, the function returns the amount of memory needed for
77 the requested information, in bytes. Otherwise, the where argument must
78 point to an unsigned 32-bit integer (uint32_t variable), except for the
79 following what values, when it must point to a variable of the type
80 shown:
81
82 PCRE2_INFO_FIRSTBITMAP const uint8_t *
83 PCRE2_INFO_JITSIZE size_t
84 PCRE2_INFO_NAMETABLE PCRE2_SPTR
85 PCRE2_INFO_SIZE size_t
86
87 The yield of the function is zero on success or:
88
89 PCRE2_ERROR_NULL the argument code is NULL
90 PCRE2_ERROR_BADMAGIC the "magic number" was not found
91 PCRE2_ERROR_BADOPTION the value of what is invalid
92 PCRE2_ERROR_BADMODE the pattern was compiled in the wrong mode
93 PCRE2_ERROR_UNSET the requested information is not set
94
95 There is a complete description of the PCRE2 native API in the pcre2api
96 page and a description of the POSIX API in the pcre2posix page.
97
98
99
100PCRE2 10.33 14 February 2019 PCRE2_PATTERN_INFO(3)