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
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 back reference
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_FIRSTBITMAP Bitmap of first code units, or NULL
34 PCRE2_INFO_FIRSTCODETYPE Type of start-of-match information
35 0 nothing set
36 1 first code unit is set
37 2 start of string or after newline
38 PCRE2_INFO_FIRSTCODEUNIT First code unit when type is 1
39 PCRE2_INFO_HASBACKSLASHC Return 1 if pattern contains \C
40 PCRE2_INFO_HASCRORLF Return 1 if explicit CR or LF matches
41 exist in the pattern
42 PCRE2_INFO_JCHANGED Return 1 if (?J) or (?-J) was used
43 PCRE2_INFO_JITSIZE Size of JIT compiled code, or 0
44 PCRE2_INFO_LASTCODETYPE Type of must-be-present information
45 0 nothing set
46 1 code unit is set
47 PCRE2_INFO_LASTCODEUNIT Last code unit when type is 1
48 PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an
49 empty string, 0 otherwise
50 PCRE2_INFO_MATCHLIMIT Match limit if set,
51 otherwise PCRE2_ERROR_UNSET
52 PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest
53 lookbehind assertion
54 PCRE2_INFO_MINLENGTH Lower bound length of matching strings
55 PCRE2_INFO_NAMECOUNT Number of named subpatterns
56 PCRE2_INFO_NAMEENTRYSIZE Size of name table entries
57 PCRE2_INFO_NAMETABLE Pointer to name table
58 PCRE2_CONFIG_NEWLINE Code for the newline sequence:
59 PCRE2_NEWLINE_CR
60 PCRE2_NEWLINE_LF
61 PCRE2_NEWLINE_CRLF
62 PCRE2_NEWLINE_ANY
63 PCRE2_NEWLINE_ANYCRLF
64 PCRE2_INFO_RECURSIONLIMIT Recursion limit if set,
65 otherwise PCRE2_ERROR_UNSET
66 PCRE2_INFO_SIZE Size of compiled pattern
67
68 If where is NULL, the function returns the amount of memory needed for
69 the requested information, in bytes. Otherwise, the where argument must
70 point to an unsigned 32-bit integer (uint32_t variable), except for the
71 following what values, when it must point to a variable of the type
72 shown:
73
74 PCRE2_INFO_FIRSTBITMAP const uint8_t *
75 PCRE2_INFO_JITSIZE size_t
76 PCRE2_INFO_NAMETABLE PCRE2_SPTR
77 PCRE2_INFO_SIZE size_t
78
79 The yield of the function is zero on success or:
80
81 PCRE2_ERROR_NULL the argument code is NULL
82 PCRE2_ERROR_BADMAGIC the "magic number" was not found
83 PCRE2_ERROR_BADOPTION the value of what is invalid
84 PCRE2_ERROR_BADMODE the pattern was compiled in the wrong mode
85 PCRE2_ERROR_UNSET the requested information is not set
86
87 There is a complete description of the PCRE2 native API in the pcre2api
88 page and a description of the POSIX API in the pcre2posix page.
89
90
91
92PCRE2 10.21 21 November 2015 PCRE2_PATTERN_INFO(3)