Home | History | Annotate | Download | only in html
      1 <html>
      2 <head>
      3 <title>pcre_compile specification</title>
      4 </head>
      5 <body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
      6 <h1>pcre_compile man page</h1>
      7 <p>
      8 Return to the <a href="index.html">PCRE index page</a>.
      9 </p>
     10 <p>
     11 This page is part of the PCRE HTML documentation. It was generated automatically
     12 from the original man page. If there is any nonsense in it, please consult the
     13 man page, in case the conversion went wrong.
     14 <br>
     15 <br><b>
     16 SYNOPSIS
     17 </b><br>
     18 <P>
     19 <b>#include &#60;pcre.h&#62;</b>
     20 </P>
     21 <P>
     22 <b>pcre *pcre_compile(const char *<i>pattern</i>, int <i>options</i>,</b>
     23 <b>     const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
     24 <b>     const unsigned char *<i>tableptr</i>);</b>
     25 <br>
     26 <br>
     27 <b>pcre16 *pcre16_compile(PCRE_SPTR16 <i>pattern</i>, int <i>options</i>,</b>
     28 <b>     const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
     29 <b>     const unsigned char *<i>tableptr</i>);</b>
     30 <br>
     31 <br>
     32 <b>pcre32 *pcre32_compile(PCRE_SPTR32 <i>pattern</i>, int <i>options</i>,</b>
     33 <b>     const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
     34 <b>     const unsigned char *<i>tableptr</i>);</b>
     35 </P>
     36 <br><b>
     37 DESCRIPTION
     38 </b><br>
     39 <P>
     40 This function compiles a regular expression into an internal form. It is the
     41 same as <b>pcre[16|32]_compile2()</b>, except for the absence of the
     42 <i>errorcodeptr</i> argument. Its arguments are:
     43 <pre>
     44   <i>pattern</i>       A zero-terminated string containing the
     45                   regular expression to be compiled
     46   <i>options</i>       Zero or more option bits
     47   <i>errptr</i>        Where to put an error message
     48   <i>erroffset</i>     Offset in pattern where error was found
     49   <i>tableptr</i>      Pointer to character tables, or NULL to
     50                   use the built-in default
     51 </pre>
     52 The option bits are:
     53 <pre>
     54   PCRE_ANCHORED           Force pattern anchoring
     55   PCRE_AUTO_CALLOUT       Compile automatic callouts
     56   PCRE_BSR_ANYCRLF        \R matches only CR, LF, or CRLF
     57   PCRE_BSR_UNICODE        \R matches all Unicode line endings
     58   PCRE_CASELESS           Do caseless matching
     59   PCRE_DOLLAR_ENDONLY     $ not to match newline at end
     60   PCRE_DOTALL             . matches anything including NL
     61   PCRE_DUPNAMES           Allow duplicate names for subpatterns
     62   PCRE_EXTENDED           Ignore white space and # comments
     63   PCRE_EXTRA              PCRE extra features
     64                             (not much use currently)
     65   PCRE_FIRSTLINE          Force matching to be before newline
     66   PCRE_JAVASCRIPT_COMPAT  JavaScript compatibility
     67   PCRE_MULTILINE          ^ and $ match newlines within data
     68   PCRE_NEVER_UTF          Lock out UTF, e.g. via (*UTF)
     69   PCRE_NEWLINE_ANY        Recognize any Unicode newline sequence
     70   PCRE_NEWLINE_ANYCRLF    Recognize CR, LF, and CRLF as newline
     71                             sequences
     72   PCRE_NEWLINE_CR         Set CR as the newline sequence
     73   PCRE_NEWLINE_CRLF       Set CRLF as the newline sequence
     74   PCRE_NEWLINE_LF         Set LF as the newline sequence
     75   PCRE_NO_AUTO_CAPTURE    Disable numbered capturing paren-
     76                             theses (named ones available)
     77   PCRE_NO_AUTO_POSSESS    Disable auto-possessification
     78   PCRE_NO_START_OPTIMIZE  Disable match-time start optimizations
     79   PCRE_NO_UTF16_CHECK     Do not check the pattern for UTF-16
     80                             validity (only relevant if
     81                             PCRE_UTF16 is set)
     82   PCRE_NO_UTF32_CHECK     Do not check the pattern for UTF-32
     83                             validity (only relevant if
     84                             PCRE_UTF32 is set)
     85   PCRE_NO_UTF8_CHECK      Do not check the pattern for UTF-8
     86                             validity (only relevant if
     87                             PCRE_UTF8 is set)
     88   PCRE_UCP                Use Unicode properties for \d, \w, etc.
     89   PCRE_UNGREEDY           Invert greediness of quantifiers
     90   PCRE_UTF16              Run in <b>pcre16_compile()</b> UTF-16 mode
     91   PCRE_UTF32              Run in <b>pcre32_compile()</b> UTF-32 mode
     92   PCRE_UTF8               Run in <b>pcre_compile()</b> UTF-8 mode
     93 </pre>
     94 PCRE must be built with UTF support in order to use PCRE_UTF8/16/32 and
     95 PCRE_NO_UTF8/16/32_CHECK, and with UCP support if PCRE_UCP is used.
     96 </P>
     97 <P>
     98 The yield of the function is a pointer to a private data structure that
     99 contains the compiled pattern, or NULL if an error was detected. Note that
    100 compiling regular expressions with one version of PCRE for use with a different
    101 version is not guaranteed to work and may cause crashes.
    102 </P>
    103 <P>
    104 There is a complete description of the PCRE native API in the
    105 <a href="pcreapi.html"><b>pcreapi</b></a>
    106 page and a description of the POSIX API in the
    107 <a href="pcreposix.html"><b>pcreposix</b></a>
    108 page.
    109 <p>
    110 Return to the <a href="index.html">PCRE index page</a>.
    111 </p>
    112