1<html>
2<head>
3<title>pcre_exec specification</title>
4</head>
5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6<h1>pcre_exec man page</h1>
7<p>
8Return to the <a href="index.html">PCRE index page</a>.
9</p>
10<p>
11This page is part of the PCRE HTML documentation. It was generated automatically
12from the original man page. If there is any nonsense in it, please consult the
13man page, in case the conversion went wrong.
14<br>
15<br><b>
16SYNOPSIS
17</b><br>
18<P>
19<b>#include &#60;pcre.h&#62;</b>
20</P>
21<P>
22<b>int pcre_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
23<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
24<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
25</P>
26<P>
27<b>int pcre16_exec(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
28<b>PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
29<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
30</P>
31<br><b>
32DESCRIPTION
33</b><br>
34<P>
35This function matches a compiled regular expression against a given subject
36string, using a matching algorithm that is similar to Perl's. It returns
37offsets to captured substrings. Its arguments are:
38<pre>
39  <i>code</i>         Points to the compiled pattern
40  <i>extra</i>        Points to an associated <b>pcre[16]_extra</b> structure,
41                 or is NULL
42  <i>subject</i>      Points to the subject string
43  <i>length</i>       Length of the subject string, in bytes
44  <i>startoffset</i>  Offset in bytes in the subject at which to
45                 start matching
46  <i>options</i>      Option bits
47  <i>ovector</i>      Points to a vector of ints for result offsets
48  <i>ovecsize</i>     Number of elements in the vector (a multiple of 3)
49</pre>
50The options are:
51<pre>
52  PCRE_ANCHORED          Match only at the first position
53  PCRE_BSR_ANYCRLF       \R matches only CR, LF, or CRLF
54  PCRE_BSR_UNICODE       \R matches all Unicode line endings
55  PCRE_NEWLINE_ANY       Recognize any Unicode newline sequence
56  PCRE_NEWLINE_ANYCRLF   Recognize CR, LF, & CRLF as newline sequences
57  PCRE_NEWLINE_CR        Recognize CR as the only newline sequence
58  PCRE_NEWLINE_CRLF      Recognize CRLF as the only newline sequence
59  PCRE_NEWLINE_LF        Recognize LF as the only newline sequence
60  PCRE_NOTBOL            Subject string is not the beginning of a line
61  PCRE_NOTEOL            Subject string is not the end of a line
62  PCRE_NOTEMPTY          An empty string is not a valid match
63  PCRE_NOTEMPTY_ATSTART  An empty string at the start of the subject
64                           is not a valid match
65  PCRE_NO_START_OPTIMIZE Do not do "start-match" optimizations
66  PCRE_NO_UTF16_CHECK    Do not check the subject for UTF-16
67                           validity (only relevant if PCRE_UTF16
68                           was set at compile time)
69  PCRE_NO_UTF8_CHECK     Do not check the subject for UTF-8
70                           validity (only relevant if PCRE_UTF8
71                           was set at compile time)
72  PCRE_PARTIAL           ) Return PCRE_ERROR_PARTIAL for a partial
73  PCRE_PARTIAL_SOFT      )   match if no full matches are found
74  PCRE_PARTIAL_HARD      Return PCRE_ERROR_PARTIAL for a partial match
75                           if that is found before a full match
76</pre>
77For details of partial matching, see the
78<a href="pcrepartial.html"><b>pcrepartial</b></a>
79page. A <b>pcre_extra</b> structure contains the following fields:
80<pre>
81  <i>flags</i>            Bits indicating which fields are set
82  <i>study_data</i>       Opaque data from <b>pcre[16]_study()</b>
83  <i>match_limit</i>      Limit on internal resource use
84  <i>match_limit_recursion</i>  Limit on internal recursion depth
85  <i>callout_data</i>     Opaque data passed back to callouts
86  <i>tables</i>           Points to character tables or is NULL
87  <i>mark</i>             For passing back a *MARK pointer
88  <i>executable_jit</i>   Opaque data from JIT compilation
89</pre>
90The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
91PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA,
92PCRE_EXTRA_TABLES, PCRE_EXTRA_MARK and PCRE_EXTRA_EXECUTABLE_JIT.
93</P>
94<P>
95There is a complete description of the PCRE native API in the
96<a href="pcreapi.html"><b>pcreapi</b></a>
97page and a description of the POSIX API in the
98<a href="pcreposix.html"><b>pcreposix</b></a>
99page.
100<p>
101Return to the <a href="index.html">PCRE index page</a>.
102</p>
103