xref: /aosp_15_r20/external/pcre/doc/html/pcre2_dfa_match.html (revision 22dc650d8ae982c6770746019a6f94af92b0f024)
1*22dc650dSSadaf Ebrahimi<html>
2*22dc650dSSadaf Ebrahimi<head>
3*22dc650dSSadaf Ebrahimi<title>pcre2_dfa_match specification</title>
4*22dc650dSSadaf Ebrahimi</head>
5*22dc650dSSadaf Ebrahimi<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6*22dc650dSSadaf Ebrahimi<h1>pcre2_dfa_match man page</h1>
7*22dc650dSSadaf Ebrahimi<p>
8*22dc650dSSadaf EbrahimiReturn to the <a href="index.html">PCRE2 index page</a>.
9*22dc650dSSadaf Ebrahimi</p>
10*22dc650dSSadaf Ebrahimi<p>
11*22dc650dSSadaf EbrahimiThis page is part of the PCRE2 HTML documentation. It was generated
12*22dc650dSSadaf Ebrahimiautomatically from the original man page. If there is any nonsense in it,
13*22dc650dSSadaf Ebrahimiplease consult the man page, in case the conversion went wrong.
14*22dc650dSSadaf Ebrahimi<br>
15*22dc650dSSadaf Ebrahimi<br><b>
16*22dc650dSSadaf EbrahimiSYNOPSIS
17*22dc650dSSadaf Ebrahimi</b><br>
18*22dc650dSSadaf Ebrahimi<P>
19*22dc650dSSadaf Ebrahimi<b>#include &#60;pcre2.h&#62;</b>
20*22dc650dSSadaf Ebrahimi</P>
21*22dc650dSSadaf Ebrahimi<P>
22*22dc650dSSadaf Ebrahimi<b>int pcre2_dfa_match(const pcre2_code *<i>code</i>, PCRE2_SPTR <i>subject</i>,</b>
23*22dc650dSSadaf Ebrahimi<b>  PCRE2_SIZE <i>length</i>, PCRE2_SIZE <i>startoffset</i>,</b>
24*22dc650dSSadaf Ebrahimi<b>  uint32_t <i>options</i>, pcre2_match_data *<i>match_data</i>,</b>
25*22dc650dSSadaf Ebrahimi<b>  pcre2_match_context *<i>mcontext</i>,</b>
26*22dc650dSSadaf Ebrahimi<b>  int *<i>workspace</i>, PCRE2_SIZE <i>wscount</i>);</b>
27*22dc650dSSadaf Ebrahimi</P>
28*22dc650dSSadaf Ebrahimi<br><b>
29*22dc650dSSadaf EbrahimiDESCRIPTION
30*22dc650dSSadaf Ebrahimi</b><br>
31*22dc650dSSadaf Ebrahimi<P>
32*22dc650dSSadaf EbrahimiThis function matches a compiled regular expression against a given subject
33*22dc650dSSadaf Ebrahimistring, using an alternative matching algorithm that scans the subject string
34*22dc650dSSadaf Ebrahimijust once (except when processing lookaround assertions). This function is
35*22dc650dSSadaf Ebrahimi<i>not</i> Perl-compatible (the Perl-compatible matching function is
36*22dc650dSSadaf Ebrahimi<b>pcre2_match()</b>). The arguments for this function are:
37*22dc650dSSadaf Ebrahimi<pre>
38*22dc650dSSadaf Ebrahimi  <i>code</i>         Points to the compiled pattern
39*22dc650dSSadaf Ebrahimi  <i>subject</i>      Points to the subject string
40*22dc650dSSadaf Ebrahimi  <i>length</i>       Length of the subject string
41*22dc650dSSadaf Ebrahimi  <i>startoffset</i>  Offset in the subject at which to start matching
42*22dc650dSSadaf Ebrahimi  <i>options</i>      Option bits
43*22dc650dSSadaf Ebrahimi  <i>match_data</i>   Points to a match data block, for results
44*22dc650dSSadaf Ebrahimi  <i>mcontext</i>     Points to a match context, or is NULL
45*22dc650dSSadaf Ebrahimi  <i>workspace</i>    Points to a vector of ints used as working space
46*22dc650dSSadaf Ebrahimi  <i>wscount</i>      Number of elements in the vector
47*22dc650dSSadaf Ebrahimi</pre>
48*22dc650dSSadaf EbrahimiThe size of output vector needed to contain all the results depends on the
49*22dc650dSSadaf Ebrahiminumber of simultaneous matches, not on the number of parentheses in the
50*22dc650dSSadaf Ebrahimipattern. Using <b>pcre2_match_data_create_from_pattern()</b> to create the match
51*22dc650dSSadaf Ebrahimidata block is therefore not advisable when using this function.
52*22dc650dSSadaf Ebrahimi</P>
53*22dc650dSSadaf Ebrahimi<P>
54*22dc650dSSadaf EbrahimiA match context is needed only if you want to set up a callout function or
55*22dc650dSSadaf Ebrahimispecify the heap limit or the match or the recursion depth limits. The
56*22dc650dSSadaf Ebrahimi<i>length</i> and <i>startoffset</i> values are code units, not characters. The
57*22dc650dSSadaf Ebrahimioptions are:
58*22dc650dSSadaf Ebrahimi<pre>
59*22dc650dSSadaf Ebrahimi  PCRE2_ANCHORED          Match only at the first position
60*22dc650dSSadaf Ebrahimi  PCRE2_COPY_MATCHED_SUBJECT
61*22dc650dSSadaf Ebrahimi                          On success, make a private subject copy
62*22dc650dSSadaf Ebrahimi  PCRE2_ENDANCHORED       Pattern can match only at end of subject
63*22dc650dSSadaf Ebrahimi  PCRE2_NOTBOL            Subject is not the beginning of a line
64*22dc650dSSadaf Ebrahimi  PCRE2_NOTEOL            Subject is not the end of a line
65*22dc650dSSadaf Ebrahimi  PCRE2_NOTEMPTY          An empty string is not a valid match
66*22dc650dSSadaf Ebrahimi  PCRE2_NOTEMPTY_ATSTART  An empty string at the start of the subject is not a valid match
67*22dc650dSSadaf Ebrahimi  PCRE2_NO_UTF_CHECK      Do not check the subject for UTF validity (only relevant if PCRE2_UTF
68*22dc650dSSadaf Ebrahimi                           was set at compile time)
69*22dc650dSSadaf Ebrahimi  PCRE2_PARTIAL_HARD      Return PCRE2_ERROR_PARTIAL for a partial match even if there is a full match
70*22dc650dSSadaf Ebrahimi  PCRE2_PARTIAL_SOFT      Return PCRE2_ERROR_PARTIAL for a partial match if no full matches are found
71*22dc650dSSadaf Ebrahimi  PCRE2_DFA_RESTART       Restart after a partial match
72*22dc650dSSadaf Ebrahimi  PCRE2_DFA_SHORTEST      Return only the shortest match
73*22dc650dSSadaf Ebrahimi</pre>
74*22dc650dSSadaf EbrahimiThere are restrictions on what may appear in a pattern when using this matching
75*22dc650dSSadaf Ebrahimifunction. Details are given in the
76*22dc650dSSadaf Ebrahimi<a href="pcre2matching.html"><b>pcre2matching</b></a>
77*22dc650dSSadaf Ebrahimidocumentation. For details of partial matching, see the
78*22dc650dSSadaf Ebrahimi<a href="pcre2partial.html"><b>pcre2partial</b></a>
79*22dc650dSSadaf Ebrahimipage. There is a complete description of the PCRE2 native API in the
80*22dc650dSSadaf Ebrahimi<a href="pcre2api.html"><b>pcre2api</b></a>
81*22dc650dSSadaf Ebrahimipage and a description of the POSIX API in the
82*22dc650dSSadaf Ebrahimi<a href="pcre2posix.html"><b>pcre2posix</b></a>
83*22dc650dSSadaf Ebrahimipage.
84*22dc650dSSadaf Ebrahimi<p>
85*22dc650dSSadaf EbrahimiReturn to the <a href="index.html">PCRE2 index page</a>.
86*22dc650dSSadaf Ebrahimi</p>
87