• 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 pattern
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 backreference
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_DEPTHLIMIT      Backtracking depth limit if set, otherwise PCRE2_ERROR_UNSET
45  PCRE2_INFO_EXTRAOPTIONS    Extra options that were passed in the
46                               compile context
47  PCRE2_INFO_FIRSTBITMAP     Bitmap of first code units, or NULL
48  PCRE2_INFO_FIRSTCODETYPE   Type of start-of-match information
49                               0 nothing set
50                               1 first code unit is set
51                               2 start of string or after newline
52  PCRE2_INFO_FIRSTCODEUNIT   First code unit when type is 1
53  PCRE2_INFO_FRAMESIZE       Size of backtracking frame
54  PCRE2_INFO_HASBACKSLASHC   Return 1 if pattern contains \C
55  PCRE2_INFO_HASCRORLF       Return 1 if explicit CR or LF matches exist in the pattern
56  PCRE2_INFO_HEAPLIMIT       Heap memory limit if set, otherwise PCRE2_ERROR_UNSET
57  PCRE2_INFO_JCHANGED        Return 1 if (?J) or (?-J) was used
58  PCRE2_INFO_JITSIZE         Size of JIT compiled code, or 0
59  PCRE2_INFO_LASTCODETYPE    Type of must-be-present information
60                               0 nothing set
61                               1 code unit is set
62  PCRE2_INFO_LASTCODEUNIT    Last code unit when type is 1
63  PCRE2_INFO_MATCHEMPTY      1 if the pattern can match an empty string, 0 otherwise
64  PCRE2_INFO_MATCHLIMIT      Match limit if set, otherwise PCRE2_ERROR_UNSET
65  PCRE2_INFO_MAXLOOKBEHIND   Length (in characters) of the longest lookbehind assertion
66  PCRE2_INFO_MINLENGTH       Lower bound length of matching strings
67  PCRE2_INFO_NAMECOUNT       Number of named subpatterns
68  PCRE2_INFO_NAMEENTRYSIZE   Size of name table entries
69  PCRE2_INFO_NAMETABLE       Pointer to name table
70  PCRE2_CONFIG_NEWLINE       Code for the newline sequence:
71                               PCRE2_NEWLINE_CR
72                               PCRE2_NEWLINE_LF
73                               PCRE2_NEWLINE_CRLF
74                               PCRE2_NEWLINE_ANY
75                               PCRE2_NEWLINE_ANYCRLF
76                               PCRE2_NEWLINE_NUL
77  PCRE2_INFO_RECURSIONLIMIT  Obsolete synonym for PCRE2_INFO_DEPTHLIMIT
78  PCRE2_INFO_SIZE            Size of compiled pattern
79</pre>
80If <i>where</i> is NULL, the function returns the amount of memory needed for
81the requested information, in bytes. Otherwise, the <i>where</i> argument must
82point to an unsigned 32-bit integer (uint32_t variable), except for the
83following <i>what</i> values, when it must point to a variable of the type
84shown:
85<pre>
86  PCRE2_INFO_FIRSTBITMAP     const uint8_t *
87  PCRE2_INFO_JITSIZE         size_t
88  PCRE2_INFO_NAMETABLE       PCRE2_SPTR
89  PCRE2_INFO_SIZE            size_t
90</pre>
91The yield of the function is zero on success or:
92<pre>
93  PCRE2_ERROR_NULL           the argument <i>code</i> is NULL
94  PCRE2_ERROR_BADMAGIC       the "magic number" was not found
95  PCRE2_ERROR_BADOPTION      the value of <i>what</i> is invalid
96  PCRE2_ERROR_BADMODE        the pattern was compiled in the wrong mode
97  PCRE2_ERROR_UNSET          the requested information is not set
98</PRE>
99</P>
100<P>
101There is a complete description of the PCRE2 native API in the
102<a href="pcre2api.html"><b>pcre2api</b></a>
103page and a description of the POSIX API in the
104<a href="pcre2posix.html"><b>pcre2posix</b></a>
105page.
106<p>
107Return to the <a href="index.html">PCRE2 index page</a>.
108</p>
109