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_BSR_ANYCRLF \R matches only CR, LF, or CRLF
37 PCRE_BSR_UNICODE \R matches all Unicode line endings
38 PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
39 PCRE_NEWLINE_ANYCRLF Recognize CR, LF, & CRLF as newline sequences
40 PCRE_NEWLINE_CR Recognize CR as the only newline sequence
41 PCRE_NEWLINE_CRLF Recognize CRLF as the only newline sequence
42 PCRE_NEWLINE_LF Recognize LF as the only newline sequence
43 PCRE_NOTBOL Subject string is not the beginning of a line
44 PCRE_NOTEOL Subject string is not the end of a line
45 PCRE_NOTEMPTY An empty string is not a valid match
46 PCRE_NOTEMPTY_ATSTART An empty string at the start of the subject
47 is not a valid match
48 PCRE_NO_START_OPTIMIZE Do not do "start-match" optimizations
49 PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
50 validity (only relevant if PCRE_UTF8
51 was set at compile time)
52 PCRE_PARTIAL ) Return PCRE_ERROR_PARTIAL for a partial
53 PCRE_PARTIAL_SOFT ) match if no full matches are found
54 PCRE_PARTIAL_HARD Return PCRE_ERROR_PARTIAL for a partial match
55 even if there is a full match as well
56
57 For details of partial matching, see the pcrepartial page. A pcre_extra
58 structure contains the following fields:
59
60 flags Bits indicating which fields are set
61 study_data Opaque data from pcre_study()
62 match_limit Limit on internal resource use
63 match_limit_recursion Limit on internal recursion depth
64 callout_data Opaque data passed back to callouts
65 tables Points to character tables or is NULL
66
67 The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
68 PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA, and
69 PCRE_EXTRA_TABLES.
70
71 There is a complete description of the PCRE native API in the pcreapi
72 page and a description of the POSIX API in the pcreposix page.
73
74
75
76 PCRE_EXEC(3)