Home | History | Annotate | Download | only in html
      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>
      8 Return to the <a href="index.html">PCRE2 index page</a>.
      9 </p>
     10 <p>
     11 This page is part of the PCRE2 HTML documentation. It was generated
     12 automatically from the original man page. If there is any nonsense in it,
     13 please consult the man page, in case the conversion went wrong.
     14 <br>
     15 <br><b>
     16 SYNOPSIS
     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>
     27 DESCRIPTION
     28 </b><br>
     29 <P>
     30 This function compiles a regular expression pattern into an internal form. Its
     31 arguments 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>
     40 The length of the pattern and any error offset that is returned are in code
     41 units, not characters. A compile context is needed only if you want to provide
     42 custom memory allocation functions, or to provide an external function for
     43 system stack size checking, or to change one or more of these parameters:
     44 <pre>
     45   What \R matches (Unicode newlines, or CR, LF, CRLF only);
     46   PCRE2's character tables;
     47   The newline character sequence;
     48   The compile time nested parentheses limit;
     49   The maximum pattern length (in code units) that is allowed.
     50   The additional options bits (see pcre2_set_compile_extra_options())
     51 </pre>
     52 The option bits are:
     53 <pre>
     54   PCRE2_ANCHORED           Force pattern anchoring
     55   PCRE2_ALLOW_EMPTY_CLASS  Allow empty classes
     56   PCRE2_ALT_BSUX           Alternative handling of \u, \U, and \x
     57   PCRE2_ALT_CIRCUMFLEX     Alternative handling of ^ in multiline mode
     58   PCRE2_ALT_VERBNAMES      Process backslashes in verb names
     59   PCRE2_AUTO_CALLOUT       Compile automatic callouts
     60   PCRE2_CASELESS           Do caseless matching
     61   PCRE2_DOLLAR_ENDONLY     $ not to match newline at end
     62   PCRE2_DOTALL             . matches anything including NL
     63   PCRE2_DUPNAMES           Allow duplicate names for subpatterns
     64   PCRE2_ENDANCHORED        Pattern can match only at end of subject
     65   PCRE2_EXTENDED           Ignore white space and # comments
     66   PCRE2_FIRSTLINE          Force matching to be before newline
     67   PCRE2_LITERAL            Pattern characters are all literal
     68   PCRE2_MATCH_UNSET_BACKREF  Match unset backreferences
     69   PCRE2_MULTILINE          ^ and $ match newlines within data
     70   PCRE2_NEVER_BACKSLASH_C  Lock out the use of \C in patterns
     71   PCRE2_NEVER_UCP          Lock out PCRE2_UCP, e.g. via (*UCP)
     72   PCRE2_NEVER_UTF          Lock out PCRE2_UTF, e.g. via (*UTF)
     73   PCRE2_NO_AUTO_CAPTURE    Disable numbered capturing paren-
     74                             theses (named ones available)
     75   PCRE2_NO_AUTO_POSSESS    Disable auto-possessification
     76   PCRE2_NO_DOTSTAR_ANCHOR  Disable automatic anchoring for .*
     77   PCRE2_NO_START_OPTIMIZE  Disable match-time start optimizations
     78   PCRE2_NO_UTF_CHECK       Do not check the pattern for UTF validity
     79                              (only relevant if PCRE2_UTF is set)
     80   PCRE2_UCP                Use Unicode properties for \d, \w, etc.
     81   PCRE2_UNGREEDY           Invert greediness of quantifiers
     82   PCRE2_USE_OFFSET_LIMIT   Enable offset limit for unanchored matching
     83   PCRE2_UTF                Treat pattern and subjects as UTF strings
     84 </pre>
     85 PCRE2 must be built with Unicode support (the default) in order to use
     86 PCRE2_UTF, PCRE2_UCP and related options.
     87 </P>
     88 <P>
     89 The yield of the function is a pointer to a private data structure that
     90 contains the compiled pattern, or NULL if an error was detected.
     91 </P>
     92 <P>
     93 There is a complete description of the PCRE2 native API, with more detail on
     94 each option, in the
     95 <a href="pcre2api.html"><b>pcre2api</b></a>
     96 page, and a description of the POSIX API in the
     97 <a href="pcre2posix.html"><b>pcre2posix</b></a>
     98 page.
     99 <p>
    100 Return to the <a href="index.html">PCRE2 index page</a>.
    101 </p>
    102