• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<title>pcre2_compile specification</title>
4</head>
5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6<h1>pcre2_compile 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>pcre2_code *pcre2_compile(PCRE2_SPTR <i>pattern</i>, PCRE2_SIZE <i>length</i>,</b>
23<b>  uint32_t <i>options</i>, int *<i>errorcode</i>, PCRE2_SIZE *<i>erroroffset,</i></b>
24<b>  pcre2_compile_context *<i>ccontext</i>);</b>
25</P>
26<br><b>
27DESCRIPTION
28</b><br>
29<P>
30This function compiles a regular expression pattern into an internal form. Its
31arguments are:
32<pre>
33  <i>pattern</i>       A string containing expression to be compiled
34  <i>length</i>        The length of the string or PCRE2_ZERO_TERMINATED
35  <i>options</i>       Option bits
36  <i>errorcode</i>     Where to put an error code
37  <i>erroffset</i>     Where to put an error offset
38  <i>ccontext</i>      Pointer to a compile context or NULL
39</pre>
40The length of the string and any error offset that is returned are in code
41units, not characters. A compile context is needed only if you want to change
42<pre>
43  What \R matches (Unicode newlines or CR, LF, CRLF only)
44  PCRE2's character tables
45  The newline character sequence
46  The compile time nested parentheses limit
47</pre>
48or provide an external function for stack size checking. The option bits are:
49<pre>
50  PCRE2_ANCHORED           Force pattern anchoring
51  PCRE2_ALT_BSUX           Alternative handling of \u, \U, and \x
52  PCRE2_ALT_CIRCUMFLEX     Alternative handling of ^ in multiline mode
53  PCRE2_AUTO_CALLOUT       Compile automatic callouts
54  PCRE2_CASELESS           Do caseless matching
55  PCRE2_DOLLAR_ENDONLY     $ not to match newline at end
56  PCRE2_DOTALL             . matches anything including NL
57  PCRE2_DUPNAMES           Allow duplicate names for subpatterns
58  PCRE2_EXTENDED           Ignore white space and # comments
59  PCRE2_FIRSTLINE          Force matching to be before newline
60  PCRE2_MATCH_UNSET_BACKREF  Match unset back references
61  PCRE2_MULTILINE          ^ and $ match newlines within data
62  PCRE2_NEVER_BACKSLASH_C  Lock out the use of \C in patterns
63  PCRE2_NEVER_UCP          Lock out PCRE2_UCP, e.g. via (*UCP)
64  PCRE2_NEVER_UTF          Lock out PCRE2_UTF, e.g. via (*UTF)
65  PCRE2_NO_AUTO_CAPTURE    Disable numbered capturing paren-
66                            theses (named ones available)
67  PCRE2_NO_AUTO_POSSESS    Disable auto-possessification
68  PCRE2_NO_DOTSTAR_ANCHOR  Disable automatic anchoring for .*
69  PCRE2_NO_START_OPTIMIZE  Disable match-time start optimizations
70  PCRE2_NO_UTF_CHECK       Do not check the pattern for UTF validity
71                             (only relevant if PCRE2_UTF is set)
72  PCRE2_UCP                Use Unicode properties for \d, \w, etc.
73  PCRE2_UNGREEDY           Invert greediness of quantifiers
74  PCRE2_UTF                Treat pattern and subjects as UTF strings
75</pre>
76PCRE2 must be built with Unicode support in order to use PCRE2_UTF, PCRE2_UCP
77and related options.
78</P>
79<P>
80The yield of the function is a pointer to a private data structure that
81contains the compiled pattern, or NULL if an error was detected.
82</P>
83<P>
84There is a complete description of the PCRE2 native API in the
85<a href="pcre2api.html"><b>pcre2api</b></a>
86page and a description of the POSIX API in the
87<a href="pcre2posix.html"><b>pcre2posix</b></a>
88page.
89<p>
90Return to the <a href="index.html">PCRE2 index page</a>.
91</p>
92