xref: /aosp_15_r20/external/pcre/doc/html/pcre2_pattern_info.html (revision 22dc650d8ae982c6770746019a6f94af92b0f024)
1*22dc650dSSadaf Ebrahimi<html>
2*22dc650dSSadaf Ebrahimi<head>
3*22dc650dSSadaf Ebrahimi<title>pcre2_pattern_info specification</title>
4*22dc650dSSadaf Ebrahimi</head>
5*22dc650dSSadaf Ebrahimi<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6*22dc650dSSadaf Ebrahimi<h1>pcre2_pattern_info man page</h1>
7*22dc650dSSadaf Ebrahimi<p>
8*22dc650dSSadaf EbrahimiReturn to the <a href="index.html">PCRE2 index page</a>.
9*22dc650dSSadaf Ebrahimi</p>
10*22dc650dSSadaf Ebrahimi<p>
11*22dc650dSSadaf EbrahimiThis page is part of the PCRE2 HTML documentation. It was generated
12*22dc650dSSadaf Ebrahimiautomatically from the original man page. If there is any nonsense in it,
13*22dc650dSSadaf Ebrahimiplease consult the man page, in case the conversion went wrong.
14*22dc650dSSadaf Ebrahimi<br>
15*22dc650dSSadaf Ebrahimi<br><b>
16*22dc650dSSadaf EbrahimiSYNOPSIS
17*22dc650dSSadaf Ebrahimi</b><br>
18*22dc650dSSadaf Ebrahimi<P>
19*22dc650dSSadaf Ebrahimi<b>#include &#60;pcre2.h&#62;</b>
20*22dc650dSSadaf Ebrahimi</P>
21*22dc650dSSadaf Ebrahimi<P>
22*22dc650dSSadaf Ebrahimi<b>int pcre2_pattern_info(const pcre2_code *<i>code</i>, uint32_t <i>what</i>,</b>
23*22dc650dSSadaf Ebrahimi<b>   void *<i>where</i>);</b>
24*22dc650dSSadaf Ebrahimi</P>
25*22dc650dSSadaf Ebrahimi<br><b>
26*22dc650dSSadaf EbrahimiDESCRIPTION
27*22dc650dSSadaf Ebrahimi</b><br>
28*22dc650dSSadaf Ebrahimi<P>
29*22dc650dSSadaf EbrahimiThis function returns information about a compiled pattern. Its arguments are:
30*22dc650dSSadaf Ebrahimi<pre>
31*22dc650dSSadaf Ebrahimi  <i>code</i>     Pointer to a compiled regular expression pattern
32*22dc650dSSadaf Ebrahimi  <i>what</i>     What information is required
33*22dc650dSSadaf Ebrahimi  <i>where</i>    Where to put the information
34*22dc650dSSadaf Ebrahimi</pre>
35*22dc650dSSadaf EbrahimiThe recognized values for the <i>what</i> argument, and the information they
36*22dc650dSSadaf Ebrahimirequest are as follows:
37*22dc650dSSadaf Ebrahimi<pre>
38*22dc650dSSadaf Ebrahimi  PCRE2_INFO_ALLOPTIONS      Final options after compiling
39*22dc650dSSadaf Ebrahimi  PCRE2_INFO_ARGOPTIONS      Options passed to <b>pcre2_compile()</b>
40*22dc650dSSadaf Ebrahimi  PCRE2_INFO_BACKREFMAX      Number of highest backreference
41*22dc650dSSadaf Ebrahimi  PCRE2_INFO_BSR             What \R matches:
42*22dc650dSSadaf Ebrahimi                               PCRE2_BSR_UNICODE: Unicode line endings
43*22dc650dSSadaf Ebrahimi                               PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only
44*22dc650dSSadaf Ebrahimi  PCRE2_INFO_CAPTURECOUNT    Number of capturing subpatterns
45*22dc650dSSadaf Ebrahimi  PCRE2_INFO_DEPTHLIMIT      Backtracking depth limit if set, otherwise PCRE2_ERROR_UNSET
46*22dc650dSSadaf Ebrahimi  PCRE2_INFO_EXTRAOPTIONS    Extra options that were passed in the
47*22dc650dSSadaf Ebrahimi                               compile context
48*22dc650dSSadaf Ebrahimi  PCRE2_INFO_FIRSTBITMAP     Bitmap of first code units, or NULL
49*22dc650dSSadaf Ebrahimi  PCRE2_INFO_FIRSTCODETYPE   Type of start-of-match information
50*22dc650dSSadaf Ebrahimi                               0 nothing set
51*22dc650dSSadaf Ebrahimi                               1 first code unit is set
52*22dc650dSSadaf Ebrahimi                               2 start of string or after newline
53*22dc650dSSadaf Ebrahimi  PCRE2_INFO_FIRSTCODEUNIT   First code unit when type is 1
54*22dc650dSSadaf Ebrahimi  PCRE2_INFO_FRAMESIZE       Size of backtracking frame
55*22dc650dSSadaf Ebrahimi  PCRE2_INFO_HASBACKSLASHC   Return 1 if pattern contains \C
56*22dc650dSSadaf Ebrahimi  PCRE2_INFO_HASCRORLF       Return 1 if explicit CR or LF matches exist in the pattern
57*22dc650dSSadaf Ebrahimi  PCRE2_INFO_HEAPLIMIT       Heap memory limit if set, otherwise PCRE2_ERROR_UNSET
58*22dc650dSSadaf Ebrahimi  PCRE2_INFO_JCHANGED        Return 1 if (?J) or (?-J) was used
59*22dc650dSSadaf Ebrahimi  PCRE2_INFO_JITSIZE         Size of JIT compiled code, or 0
60*22dc650dSSadaf Ebrahimi  PCRE2_INFO_LASTCODETYPE    Type of must-be-present information
61*22dc650dSSadaf Ebrahimi                               0 nothing set
62*22dc650dSSadaf Ebrahimi                               1 code unit is set
63*22dc650dSSadaf Ebrahimi  PCRE2_INFO_LASTCODEUNIT    Last code unit when type is 1
64*22dc650dSSadaf Ebrahimi  PCRE2_INFO_MATCHEMPTY      1 if the pattern can match an empty string, 0 otherwise
65*22dc650dSSadaf Ebrahimi  PCRE2_INFO_MATCHLIMIT      Match limit if set, otherwise PCRE2_ERROR_UNSET
66*22dc650dSSadaf Ebrahimi  PCRE2_INFO_MAXLOOKBEHIND   Length (in characters) of the longest lookbehind assertion
67*22dc650dSSadaf Ebrahimi  PCRE2_INFO_MINLENGTH       Lower bound length of matching strings
68*22dc650dSSadaf Ebrahimi  PCRE2_INFO_NAMECOUNT       Number of named subpatterns
69*22dc650dSSadaf Ebrahimi  PCRE2_INFO_NAMEENTRYSIZE   Size of name table entries
70*22dc650dSSadaf Ebrahimi  PCRE2_INFO_NAMETABLE       Pointer to name table
71*22dc650dSSadaf Ebrahimi  PCRE2_CONFIG_NEWLINE       Code for the newline sequence:
72*22dc650dSSadaf Ebrahimi                               PCRE2_NEWLINE_CR
73*22dc650dSSadaf Ebrahimi                               PCRE2_NEWLINE_LF
74*22dc650dSSadaf Ebrahimi                               PCRE2_NEWLINE_CRLF
75*22dc650dSSadaf Ebrahimi                               PCRE2_NEWLINE_ANY
76*22dc650dSSadaf Ebrahimi                               PCRE2_NEWLINE_ANYCRLF
77*22dc650dSSadaf Ebrahimi                               PCRE2_NEWLINE_NUL
78*22dc650dSSadaf Ebrahimi  PCRE2_INFO_RECURSIONLIMIT  Obsolete synonym for PCRE2_INFO_DEPTHLIMIT
79*22dc650dSSadaf Ebrahimi  PCRE2_INFO_SIZE            Size of compiled pattern
80*22dc650dSSadaf Ebrahimi</pre>
81*22dc650dSSadaf EbrahimiIf <i>where</i> is NULL, the function returns the amount of memory needed for
82*22dc650dSSadaf Ebrahimithe requested information, in bytes. Otherwise, the <i>where</i> argument must
83*22dc650dSSadaf Ebrahimipoint to an unsigned 32-bit integer (uint32_t variable), except for the
84*22dc650dSSadaf Ebrahimifollowing <i>what</i> values, when it must point to a variable of the type
85*22dc650dSSadaf Ebrahimishown:
86*22dc650dSSadaf Ebrahimi<pre>
87*22dc650dSSadaf Ebrahimi  PCRE2_INFO_FIRSTBITMAP     const uint8_t *
88*22dc650dSSadaf Ebrahimi  PCRE2_INFO_JITSIZE         size_t
89*22dc650dSSadaf Ebrahimi  PCRE2_INFO_NAMETABLE       PCRE2_SPTR
90*22dc650dSSadaf Ebrahimi  PCRE2_INFO_SIZE            size_t
91*22dc650dSSadaf Ebrahimi</pre>
92*22dc650dSSadaf EbrahimiThe yield of the function is zero on success or:
93*22dc650dSSadaf Ebrahimi<pre>
94*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_NULL           the argument <i>code</i> is NULL
95*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_BADMAGIC       the "magic number" was not found
96*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_BADOPTION      the value of <i>what</i> is invalid
97*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_BADMODE        the pattern was compiled in the wrong mode
98*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_UNSET          the requested information is not set
99*22dc650dSSadaf Ebrahimi</PRE>
100*22dc650dSSadaf Ebrahimi</P>
101*22dc650dSSadaf Ebrahimi<P>
102*22dc650dSSadaf EbrahimiThere is a complete description of the PCRE2 native API in the
103*22dc650dSSadaf Ebrahimi<a href="pcre2api.html"><b>pcre2api</b></a>
104*22dc650dSSadaf Ebrahimipage and a description of the POSIX API in the
105*22dc650dSSadaf Ebrahimi<a href="pcre2posix.html"><b>pcre2posix</b></a>
106*22dc650dSSadaf Ebrahimipage.
107*22dc650dSSadaf Ebrahimi<p>
108*22dc650dSSadaf EbrahimiReturn to the <a href="index.html">PCRE2 index page</a>.
109*22dc650dSSadaf Ebrahimi</p>
110