• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<title>pcre2_match specification</title>
4</head>
5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6<h1>pcre2_match 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>int pcre2_match(const pcre2_code *<i>code</i>, PCRE2_SPTR <i>subject</i>,</b>
23<b>  PCRE2_SIZE <i>length</i>, PCRE2_SIZE <i>startoffset</i>,</b>
24<b>  uint32_t <i>options</i>, pcre2_match_data *<i>match_data</i>,</b>
25<b>  pcre2_match_context *<i>mcontext</i>);</b>
26</P>
27<br><b>
28DESCRIPTION
29</b><br>
30<P>
31This function matches a compiled regular expression against a given subject
32string, using a matching algorithm that is similar to Perl's. It returns
33offsets to captured substrings. Its arguments are:
34<pre>
35  <i>code</i>         Points to the compiled pattern
36  <i>subject</i>      Points to the subject string
37  <i>length</i>       Length of the subject string
38  <i>startoffset</i>  Offset in the subject at which to start matching
39  <i>options</i>      Option bits
40  <i>match_data</i>   Points to a match data block, for results
41  <i>mcontext</i>     Points to a match context, or is NULL
42</pre>
43A match context is needed only if you want to:
44<pre>
45  Set up a callout function
46  Change the limit for calling the internal function <i>match()</i>
47  Change the limit for calling <i>match()</i> recursively
48  Set custom memory management when the heap is used for recursion
49</pre>
50The <i>length</i> and <i>startoffset</i> values are code
51units, not characters. The options are:
52<pre>
53  PCRE2_ANCHORED          Match only at the first position
54  PCRE2_NOTBOL            Subject string is not the beginning of a line
55  PCRE2_NOTEOL            Subject string is not the end of a line
56  PCRE2_NOTEMPTY          An empty string is not a valid match
57  PCRE2_NOTEMPTY_ATSTART  An empty string at the start of the subject
58                           is not a valid match
59  PCRE2_NO_UTF_CHECK      Do not check the subject for UTF
60                           validity (only relevant if PCRE2_UTF
61                           was set at compile time)
62  PCRE2_PARTIAL_SOFT      Return PCRE2_ERROR_PARTIAL for a partial
63                            match if no full matches are found
64  PCRE2_PARTIAL_HARD      Return PCRE2_ERROR_PARTIAL for a partial match
65                           if that is found before a full match
66</pre>
67For details of partial matching, see the
68<a href="pcre2partial.html"><b>pcre2partial</b></a>
69page. There is a complete description of the PCRE2 native API in the
70<a href="pcre2api.html"><b>pcre2api</b></a>
71page and a description of the POSIX API in the
72<a href="pcre2posix.html"><b>pcre2posix</b></a>
73page.
74<p>
75Return to the <a href="index.html">PCRE2 index page</a>.
76</p>
77