| 1 |
.TH PCRE_EXEC 3 "12 May 2013" "PCRE 8.33"
|
| 2 |
.SH NAME
|
| 3 |
PCRE - Perl-compatible regular expressions
|
| 4 |
.SH SYNOPSIS
|
| 5 |
.rs
|
| 6 |
.sp
|
| 7 |
.B #include <pcre.h>
|
| 8 |
.PP
|
| 9 |
.SM
|
| 10 |
.B int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
|
| 11 |
.ti +5n
|
| 12 |
.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
|
| 13 |
.ti +5n
|
| 14 |
.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
|
| 15 |
.PP
|
| 16 |
.B int pcre16_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
|
| 17 |
.ti +5n
|
| 18 |
.B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
|
| 19 |
.ti +5n
|
| 20 |
.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
|
| 21 |
.PP
|
| 22 |
.B int pcre32_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
|
| 23 |
.ti +5n
|
| 24 |
.B "PCRE_SPTR32 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
|
| 25 |
.ti +5n
|
| 26 |
.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
|
| 27 |
.
|
| 28 |
.SH DESCRIPTION
|
| 29 |
.rs
|
| 30 |
.sp
|
| 31 |
This function matches a compiled regular expression against a given subject
|
| 32 |
string, using a matching algorithm that is similar to Perl's. It returns
|
| 33 |
offsets to captured substrings. Its arguments are:
|
| 34 |
.sp
|
| 35 |
\fIcode\fP Points to the compiled pattern
|
| 36 |
\fIextra\fP Points to an associated \fBpcre[16|32]_extra\fP structure,
|
| 37 |
or is NULL
|
| 38 |
\fIsubject\fP Points to the subject string
|
| 39 |
\fIlength\fP Length of the subject string
|
| 40 |
\fIstartoffset\fP Offset in the subject at which to start matching
|
| 41 |
\fIoptions\fP Option bits
|
| 42 |
\fIovector\fP Points to a vector of ints for result offsets
|
| 43 |
\fIovecsize\fP Number of elements in the vector (a multiple of 3)
|
| 44 |
.sp
|
| 45 |
The units for \fIlength\fP and \fIstartoffset\fP are bytes for
|
| 46 |
\fBpcre_exec()\fP, 16-bit data items for \fBpcre16_exec()\fP, and 32-bit items
|
| 47 |
for \fBpcre32_exec()\fP. The options are:
|
| 48 |
.sp
|
| 49 |
PCRE_ANCHORED Match only at the first position
|
| 50 |
PCRE_BSR_ANYCRLF \eR matches only CR, LF, or CRLF
|
| 51 |
PCRE_BSR_UNICODE \eR matches all Unicode line endings
|
| 52 |
PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
|
| 53 |
PCRE_NEWLINE_ANYCRLF Recognize CR, LF, & CRLF as newline sequences
|
| 54 |
PCRE_NEWLINE_CR Recognize CR as the only newline sequence
|
| 55 |
PCRE_NEWLINE_CRLF Recognize CRLF as the only newline sequence
|
| 56 |
PCRE_NEWLINE_LF Recognize LF as the only newline sequence
|
| 57 |
PCRE_NOTBOL Subject string is not the beginning of a line
|
| 58 |
PCRE_NOTEOL Subject string is not the end of a line
|
| 59 |
PCRE_NOTEMPTY An empty string is not a valid match
|
| 60 |
PCRE_NOTEMPTY_ATSTART An empty string at the start of the subject
|
| 61 |
is not a valid match
|
| 62 |
PCRE_NO_START_OPTIMIZE Do not do "start-match" optimizations
|
| 63 |
PCRE_NO_UTF16_CHECK Do not check the subject for UTF-16
|
| 64 |
validity (only relevant if PCRE_UTF16
|
| 65 |
was set at compile time)
|
| 66 |
PCRE_NO_UTF32_CHECK Do not check the subject for UTF-32
|
| 67 |
validity (only relevant if PCRE_UTF32
|
| 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 |
.sp
|
| 77 |
For details of partial matching, see the
|
| 78 |
.\" HREF
|
| 79 |
\fBpcrepartial\fP
|
| 80 |
.\"
|
| 81 |
page. A \fBpcre_extra\fP structure contains the following fields:
|
| 82 |
.sp
|
| 83 |
\fIflags\fP Bits indicating which fields are set
|
| 84 |
\fIstudy_data\fP Opaque data from \fBpcre[16|32]_study()\fP
|
| 85 |
\fImatch_limit\fP Limit on internal resource use
|
| 86 |
\fImatch_limit_recursion\fP Limit on internal recursion depth
|
| 87 |
\fIcallout_data\fP Opaque data passed back to callouts
|
| 88 |
\fItables\fP Points to character tables or is NULL
|
| 89 |
\fImark\fP For passing back a *MARK pointer
|
| 90 |
\fIexecutable_jit\fP Opaque data from JIT compilation
|
| 91 |
.sp
|
| 92 |
The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
|
| 93 |
PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA,
|
| 94 |
PCRE_EXTRA_TABLES, PCRE_EXTRA_MARK and PCRE_EXTRA_EXECUTABLE_JIT.
|
| 95 |
.P
|
| 96 |
There is a complete description of the PCRE native API in the
|
| 97 |
.\" HREF
|
| 98 |
\fBpcreapi\fP
|
| 99 |
.\"
|
| 100 |
page and a description of the POSIX API in the
|
| 101 |
.\" HREF
|
| 102 |
\fBpcreposix\fP
|
| 103 |
.\"
|
| 104 |
page.
|