1PCRE2_MATCH(3) Library Functions Manual PCRE2_MATCH(3)
2
3
4
6 PCRE2 - Perl-compatible regular expressions (revised API)
7
9
10 #include <pcre2.h>
11
12 int pcre2_match(const pcre2_code *code, PCRE2_SPTR subject,
13 PCRE2_SIZE length, PCRE2_SIZE startoffset,
14 uint32_t options, pcre2_match_data *match_data,
15 pcre2_match_context *mcontext);
16
18
19 This function matches a compiled regular expression against a given
20 subject string, using a matching algorithm that is similar to Perl's.
21 It returns offsets to captured substrings. Its arguments are:
22
23 code Points to the compiled pattern
24 subject Points to the subject string
25 length Length of the subject string
26 startoffset Offset in the subject at which to start matching
27 options Option bits
28 match_data Points to a match data block, for results
29 mcontext Points to a match context, or is NULL
30
31 A match context is needed only if you want to:
32
33 Set up a callout function
34 Change the limit for calling the internal function match()
35 Change the limit for calling match() recursively
36 Set custom memory management when the heap is used for recursion
37
38 The length and startoffset values are code units, not characters. The
39 options are:
40
41 PCRE2_ANCHORED Match only at the first position
42 PCRE2_NOTBOL Subject string is not the beginning of a line
43 PCRE2_NOTEOL Subject string is not the end of a line
44 PCRE2_NOTEMPTY An empty string is not a valid match
45 PCRE2_NOTEMPTY_ATSTART An empty string at the start of the subject
46 is not a valid match
47 PCRE2_NO_UTF_CHECK Do not check the subject for UTF
48 validity (only relevant if PCRE2_UTF
49 was set at compile time)
50 PCRE2_PARTIAL_SOFT Return PCRE2_ERROR_PARTIAL for a partial
51 match if no full matches are found
52 PCRE2_PARTIAL_HARD Return PCRE2_ERROR_PARTIAL for a partial
53 match
54 if that is found before a full match
55
56 For details of partial matching, see the pcre2partial page. There is a
57 complete description of the PCRE2 native API in the pcre2api page and a
58 description of the POSIX API in the pcre2posix page.
59
60
61
62PCRE2 10.00 21 October 2014 PCRE2_MATCH(3)