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