1PCRE_EXEC(3) Library Functions Manual PCRE_EXEC(3)
2
3
4
6 PCRE - Perl-compatible regular expressions
7
9
10 #include <pcre.h>
11
12 int pcre_exec(const pcre *code, const pcre_extra *extra,
13 const char *subject, int length, int startoffset,
14 int options, int *ovector, int ovecsize);
15
17
18 This function matches a compiled regular expression against a given
19 subject string, using a matching algorithm that is similar to Perl's.
20 It returns offsets to captured substrings. Its arguments are:
21
22 code Points to the compiled pattern
23 extra Points to an associated pcre_extra structure,
24 or is NULL
25 subject Points to the subject string
26 length Length of the subject string, in bytes
27 startoffset Offset in bytes in the subject at which to
28 start matching
29 options Option bits
30 ovector Points to a vector of ints for result offsets
31 ovecsize Number of elements in the vector (a multiple of 3)
32
33 The options are:
34
35 PCRE_ANCHORED Match only at the first position
36 PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
37 PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline sequences
38 PCRE_NEWLINE_CR Set CR as the newline sequence
39 PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
40 PCRE_NEWLINE_LF Set LF as the newline sequence
41 PCRE_NOTBOL Subject is not the beginning of a line
42 PCRE_NOTEOL Subject is not the end of a line
43 PCRE_NOTEMPTY An empty string is not a valid match
44 PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
45 validity (only relevant if PCRE_UTF8
46 was set at compile time)
47 PCRE_PARTIAL Return PCRE_ERROR_PARTIAL for a partial match
48
49 There are restrictions on what may appear in a pattern when partial
50 matching is requested. For details, see the pcrepartial page.
51
52 A pcre_extra structure contains the following fields:
53
54 flags Bits indicating which fields are set
55 study_data Opaque data from pcre_study()
56 match_limit Limit on internal resource use
57 match_limit_recursion Limit on internal recursion depth
58 callout_data Opaque data passed back to callouts
59 tables Points to character tables or is NULL
60
61 The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
62 PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA, and
63 PCRE_EXTRA_TABLES.
64
65 There is a complete description of the PCRE native API in the pcreapi
66 page and a description of the POSIX API in the pcreposix page.
67
68
69
70 PCRE_EXEC(3)