Elliott Hughes | 5b80804 | 2021-10-01 10:56:10 -0700 | [diff] [blame] | 1 | .TH PCRE2_DFA_MATCH 3 "28 August 2021" "PCRE2 10.38" |
| 2 | .SH NAME |
| 3 | PCRE2 - Perl-compatible regular expressions (revised API) |
| 4 | .SH SYNOPSIS |
| 5 | .rs |
| 6 | .sp |
| 7 | .B #include <pcre2.h> |
| 8 | .PP |
| 9 | .nf |
| 10 | .B int pcre2_dfa_match(const pcre2_code *\fIcode\fP, PCRE2_SPTR \fIsubject\fP, |
| 11 | .B " PCRE2_SIZE \fIlength\fP, PCRE2_SIZE \fIstartoffset\fP," |
| 12 | .B " uint32_t \fIoptions\fP, pcre2_match_data *\fImatch_data\fP," |
| 13 | .B " pcre2_match_context *\fImcontext\fP," |
| 14 | .B " int *\fIworkspace\fP, PCRE2_SIZE \fIwscount\fP);" |
| 15 | .fi |
| 16 | . |
| 17 | .SH DESCRIPTION |
| 18 | .rs |
| 19 | .sp |
| 20 | This function matches a compiled regular expression against a given subject |
| 21 | string, using an alternative matching algorithm that scans the subject string |
| 22 | just once (except when processing lookaround assertions). This function is |
| 23 | \fInot\fP Perl-compatible (the Perl-compatible matching function is |
| 24 | \fBpcre2_match()\fP). The arguments for this function are: |
| 25 | .sp |
| 26 | \fIcode\fP Points to the compiled pattern |
| 27 | \fIsubject\fP Points to the subject string |
| 28 | \fIlength\fP Length of the subject string |
| 29 | \fIstartoffset\fP Offset in the subject at which to start matching |
| 30 | \fIoptions\fP Option bits |
| 31 | \fImatch_data\fP Points to a match data block, for results |
| 32 | \fImcontext\fP Points to a match context, or is NULL |
| 33 | \fIworkspace\fP Points to a vector of ints used as working space |
| 34 | \fIwscount\fP Number of elements in the vector |
| 35 | .sp |
| 36 | The size of output vector needed to contain all the results depends on the |
| 37 | number of simultaneous matches, not on the number of parentheses in the |
| 38 | pattern. Using \fBpcre2_match_data_create_from_pattern()\fP to create the match |
| 39 | data block is therefore not advisable when using this function. |
| 40 | .P |
| 41 | A match context is needed only if you want to set up a callout function or |
| 42 | specify the heap limit or the match or the recursion depth limits. The |
| 43 | \fIlength\fP and \fIstartoffset\fP values are code units, not characters. The |
| 44 | options are: |
| 45 | .sp |
| 46 | PCRE2_ANCHORED Match only at the first position |
| 47 | PCRE2_COPY_MATCHED_SUBJECT |
| 48 | On success, make a private subject copy |
| 49 | PCRE2_ENDANCHORED Pattern can match only at end of subject |
| 50 | PCRE2_NOTBOL Subject is not the beginning of a line |
| 51 | PCRE2_NOTEOL Subject is not the end of a line |
| 52 | PCRE2_NOTEMPTY An empty string is not a valid match |
| 53 | .\" JOIN |
| 54 | PCRE2_NOTEMPTY_ATSTART An empty string at the start of the subject |
| 55 | is not a valid match |
| 56 | .\" JOIN |
| 57 | PCRE2_NO_UTF_CHECK Do not check the subject for UTF |
| 58 | validity (only relevant if PCRE2_UTF |
| 59 | was set at compile time) |
| 60 | .\" JOIN |
| 61 | PCRE2_PARTIAL_HARD Return PCRE2_ERROR_PARTIAL for a partial |
| 62 | match even if there is a full match |
| 63 | .\" JOIN |
| 64 | PCRE2_PARTIAL_SOFT Return PCRE2_ERROR_PARTIAL for a partial |
| 65 | match if no full matches are found |
| 66 | PCRE2_DFA_RESTART Restart after a partial match |
| 67 | PCRE2_DFA_SHORTEST Return only the shortest match |
| 68 | .sp |
| 69 | There are restrictions on what may appear in a pattern when using this matching |
| 70 | function. Details are given in the |
| 71 | .\" HREF |
| 72 | \fBpcre2matching\fP |
| 73 | .\" |
| 74 | documentation. For details of partial matching, see the |
| 75 | .\" HREF |
| 76 | \fBpcre2partial\fP |
| 77 | .\" |
| 78 | page. There is a complete description of the PCRE2 native API in the |
| 79 | .\" HREF |
| 80 | \fBpcre2api\fP |
| 81 | .\" |
| 82 | page and a description of the POSIX API in the |
| 83 | .\" HREF |
| 84 | \fBpcre2posix\fP |
| 85 | .\" |
| 86 | page. |