1PCRE2_DFA_MATCH(3) Library Functions Manual PCRE2_DFA_MATCH(3)
2
3
4
6 PCRE2 - Perl-compatible regular expressions (revised API)
7
9
10 #include <pcre2.h>
11
12 int pcre2_dfa_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 int *workspace, PCRE2_SIZE wscount);
17
19
20 This function matches a compiled regular expression against a given
21 subject string, using an alternative matching algorithm that scans the
22 subject string just once (except when processing lookaround asser‐
23 tions). This function is not Perl-compatible (the Perl-compatible
24 matching function is pcre2_match()). The arguments for this function
25 are:
26
27 code Points to the compiled pattern
28 subject Points to the subject string
29 length Length of the subject string
30 startoffset Offset in the subject at which to start matching
31 options Option bits
32 match_data Points to a match data block, for results
33 mcontext Points to a match context, or is NULL
34 workspace Points to a vector of ints used as working space
35 wscount Number of elements in the vector
36
37 The size of output vector needed to contain all the results depends on
38 the number of simultaneous matches, not on the number of parentheses in
39 the pattern. Using pcre2_match_data_create_from_pattern() to create the
40 match data block is therefore not advisable when using this function.
41
42 A match context is needed only if you want to set up a callout function
43 or specify the heap limit or the match or the recursion depth limits.
44 The length and startoffset values are code units, not characters. The
45 options are:
46
47 PCRE2_ANCHORED Match only at the first position
48 PCRE2_COPY_MATCHED_SUBJECT
49 On success, make a private subject copy
50 PCRE2_ENDANCHORED Pattern can match only at end of subject
51 PCRE2_NOTBOL Subject is not the beginning of a line
52 PCRE2_NOTEOL Subject is not the end of a line
53 PCRE2_NOTEMPTY An empty string is not a valid match
54 PCRE2_NOTEMPTY_ATSTART An empty string at the start of the subject
55 is not a valid match
56 PCRE2_NO_UTF_CHECK Do not check the subject for UTF
57 validity (only relevant if PCRE2_UTF
58 was set at compile time)
59 PCRE2_PARTIAL_HARD Return PCRE2_ERROR_PARTIAL for a partial
60 match even if there is a full match
61 PCRE2_PARTIAL_SOFT Return PCRE2_ERROR_PARTIAL for a partial
62 match if no full matches are found
63 PCRE2_DFA_RESTART Restart after a partial match
64 PCRE2_DFA_SHORTEST Return only the shortest match
65
66 There are restrictions on what may appear in a pattern when using this
67 matching function. Details are given in the pcre2matching documenta‐
68 tion. For details of partial matching, see the pcre2partial page. There
69 is a complete description of the PCRE2 native API in the pcre2api page
70 and a description of the POSIX API in the pcre2posix page.
71
72
73
74PCRE2 10.38 28 August 2021 PCRE2_DFA_MATCH(3)