116 lines
6.4 KiB
HTML
116 lines
6.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of PCRE2_MATCH</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>PCRE2_MATCH</H1>
|
|
Section: C Library Functions (3)<BR>Updated: 16 October 2018<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>int pcre2_match(const pcre2_code *</B><I>code</I>, PCRE2_SPTR <I>subject</I>,
|
|
<B> PCRE2_SIZE </B><I>length</I>, PCRE2_SIZE <I>startoffset</I>,
|
|
<B> uint32_t </B><I>options</I>, pcre2_match_data *<I>match_data</I>,
|
|
<B> pcre2_match_context *</B><I>mcontext</I>);
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
<P>
|
|
This function matches a compiled regular expression against a given subject
|
|
string, using a matching algorithm that is similar to Perl's. It returns
|
|
offsets to what it has matched and to captured substrings via the
|
|
<B>match_data</B> block, which can be processed by functions with names that
|
|
start with <B>pcre2_get_ovector_...()</B> or <B>pcre2_substring_...()</B>. The
|
|
return from <B>pcre2_match()</B> is one more than the highest numbered capturing
|
|
pair that has been set (for example, 1 if there are no captures), zero if the
|
|
vector of offsets is too small, or a negative error code for no match and other
|
|
errors. The function arguments are:
|
|
<P>
|
|
<BR> <I>code</I> Points to the compiled pattern
|
|
<BR> <I>subject</I> Points to the subject string
|
|
<BR> <I>length</I> Length of the subject string
|
|
<BR> <I>startoffset</I> Offset in the subject at which to start matching
|
|
<BR> <I>options</I> Option bits
|
|
<BR> <I>match_data</I> Points to a match data block, for results
|
|
<BR> <I>mcontext</I> Points to a match context, or is NULL
|
|
<P>
|
|
A match context is needed only if you want to:
|
|
<P>
|
|
<BR> Set up a callout function
|
|
<BR> Set a matching offset limit
|
|
<BR> Change the heap memory limit
|
|
<BR> Change the backtracking match limit
|
|
<BR> Change the backtracking depth limit
|
|
<BR> Set custom memory management specifically for the match
|
|
<P>
|
|
The <I>length</I> and <I>startoffset</I> values are code units, not characters.
|
|
The length may be given as PCRE2_ZERO_TERMINATED for a subject that is
|
|
terminated by a binary zero code unit. The options are:
|
|
<P>
|
|
<BR> PCRE2_ANCHORED Match only at the first position
|
|
<BR> PCRE2_COPY_MATCHED_SUBJECT
|
|
<BR> On success, make a private subject copy
|
|
<BR> PCRE2_ENDANCHORED Pattern can match only at end of subject
|
|
<BR> PCRE2_NOTBOL Subject string is not the beginning of a line
|
|
<BR> PCRE2_NOTEOL Subject string is not the end of a line
|
|
<BR> PCRE2_NOTEMPTY An empty string is not a valid match
|
|
|
|
<BR> PCRE2_NOTEMPTY_ATSTART An empty string at the start of the subject
|
|
<BR> is not a valid match
|
|
<BR> PCRE2_NO_JIT Do not use JIT matching
|
|
|
|
<BR> PCRE2_NO_UTF_CHECK Do not check the subject for UTF
|
|
<BR> validity (only relevant if PCRE2_UTF
|
|
<BR> was set at compile time)
|
|
|
|
<BR> PCRE2_PARTIAL_HARD Return PCRE2_ERROR_PARTIAL for a partial
|
|
<BR> match even if there is a full match
|
|
|
|
<BR> PCRE2_PARTIAL_SOFT Return PCRE2_ERROR_PARTIAL for a partial
|
|
<BR> match if no full matches are found
|
|
<P>
|
|
For details of partial matching, see the
|
|
|
|
<B>pcre2partial</B>
|
|
|
|
page. There is a complete description of the PCRE2 native API 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:50 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|