130 lines
7.7 KiB
HTML
130 lines
7.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of PCRE2_COMPILE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>PCRE2_COMPILE</H1>
|
|
Section: C Library Functions (3)<BR>Updated: 23 May 2019<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
<P>
|
|
<B>#include <<A HREF="file:///usr/include/pcre2.h">pcre2.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>pcre2_code *pcre2_compile(PCRE2_SPTR </B><I>pattern</I>, PCRE2_SIZE <I>length</I>,
|
|
<B> uint32_t </B><I>options</I>, int *<I>errorcode</I>, PCRE2_SIZE *<I>erroroffset,</I>
|
|
<B> pcre2_compile_context *</B><I>ccontext</I>);
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
<P>
|
|
This function compiles a regular expression pattern into an internal form. Its
|
|
arguments are:
|
|
<P>
|
|
<BR> <I>pattern</I> A string containing expression to be compiled
|
|
<BR> <I>length</I> The length of the string or PCRE2_ZERO_TERMINATED
|
|
<BR> <I>options</I> Option bits
|
|
<BR> <I>errorcode</I> Where to put an error code
|
|
<BR> <I>erroffset</I> Where to put an error offset
|
|
<BR> <I>ccontext</I> Pointer to a compile context or NULL
|
|
<P>
|
|
The length of the pattern and any error offset that is returned are in code
|
|
units, not characters. A compile context is needed only if you want to provide
|
|
custom memory allocation functions, or to provide an external function for
|
|
system stack size checking, or to change one or more of these parameters:
|
|
<P>
|
|
<BR> What \R matches (Unicode newlines, or CR, LF, CRLF only);
|
|
<BR> PCRE2's character tables;
|
|
<BR> The newline character sequence;
|
|
<BR> The compile time nested parentheses limit;
|
|
<BR> The maximum pattern length (in code units) that is allowed.
|
|
<BR> The additional options bits (see pcre2_set_compile_extra_options())
|
|
<P>
|
|
The option bits are:
|
|
<P>
|
|
<BR> PCRE2_ANCHORED Force pattern anchoring
|
|
<BR> PCRE2_ALLOW_EMPTY_CLASS Allow empty classes
|
|
<BR> PCRE2_ALT_BSUX Alternative handling of \u, \U, and \x
|
|
<BR> PCRE2_ALT_CIRCUMFLEX Alternative handling of ^ in multiline mode
|
|
<BR> PCRE2_ALT_VERBNAMES Process backslashes in verb names
|
|
<BR> PCRE2_AUTO_CALLOUT Compile automatic callouts
|
|
<BR> PCRE2_CASELESS Do caseless matching
|
|
<BR> PCRE2_DOLLAR_ENDONLY $ not to match newline at end
|
|
<BR> PCRE2_DOTALL . matches anything including NL
|
|
<BR> PCRE2_DUPNAMES Allow duplicate names for subpatterns
|
|
<BR> PCRE2_ENDANCHORED Pattern can match only at end of subject
|
|
<BR> PCRE2_EXTENDED Ignore white space and # comments
|
|
<BR> PCRE2_FIRSTLINE Force matching to be before newline
|
|
<BR> PCRE2_LITERAL Pattern characters are all literal
|
|
<BR> PCRE2_MATCH_INVALID_UTF Enable support for matching invalid UTF
|
|
<BR> PCRE2_MATCH_UNSET_BACKREF Match unset backreferences
|
|
<BR> PCRE2_MULTILINE ^ and $ match newlines within data
|
|
<BR> PCRE2_NEVER_BACKSLASH_C Lock out the use of \C in patterns
|
|
<BR> PCRE2_NEVER_UCP Lock out PCRE2_UCP, e.g. via (*UCP)
|
|
<BR> PCRE2_NEVER_UTF Lock out PCRE2_UTF, e.g. via (*UTF)
|
|
<BR> PCRE2_NO_AUTO_CAPTURE Disable numbered capturing paren-
|
|
<BR> theses (named ones available)
|
|
<BR> PCRE2_NO_AUTO_POSSESS Disable auto-possessification
|
|
<BR> PCRE2_NO_DOTSTAR_ANCHOR Disable automatic anchoring for .*
|
|
<BR> PCRE2_NO_START_OPTIMIZE Disable match-time start optimizations
|
|
<BR> PCRE2_NO_UTF_CHECK Do not check the pattern for UTF validity
|
|
<BR> (only relevant if PCRE2_UTF is set)
|
|
<BR> PCRE2_UCP Use Unicode properties for \d, \w, etc.
|
|
<BR> PCRE2_UNGREEDY Invert greediness of quantifiers
|
|
<BR> PCRE2_USE_OFFSET_LIMIT Enable offset limit for unanchored matching
|
|
<BR> PCRE2_UTF Treat pattern and subjects as UTF strings
|
|
<P>
|
|
PCRE2 must be built with Unicode support (the default) in order to use
|
|
PCRE2_UTF, PCRE2_UCP and related options.
|
|
<P>
|
|
|
|
Additional options may be set in the compile context via the
|
|
|
|
<B>pcre2_set_compile_extra_options</B>
|
|
|
|
function.
|
|
<P>
|
|
|
|
The yield of this function is a pointer to a private data structure that
|
|
contains the compiled pattern, or NULL if an error was detected.
|
|
<P>
|
|
|
|
There is a complete description of the PCRE2 native API, with more detail on
|
|
each option, in the
|
|
|
|
<B>pcre2api</B>
|
|
|
|
page, and a description of the POSIX API in the
|
|
|
|
<B>pcre2posix</B>
|
|
|
|
page.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:49 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|