Elliott Hughes | 5b80804 | 2021-10-01 10:56:10 -0700 | [diff] [blame] | 1 | .TH PCRE2_MATCH_DATA_CREATE_FROM_PATTERN 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 pcre2_match_data *pcre2_match_data_create_from_pattern( |
| 11 | .B " const pcre2_code *\fIcode\fP, pcre2_general_context *\fIgcontext\fP);" |
| 12 | .fi |
| 13 | . |
| 14 | .SH DESCRIPTION |
| 15 | .rs |
| 16 | .sp |
| 17 | This function creates a new match data block for holding the result of a match. |
| 18 | The first argument points to a compiled pattern. The number of capturing |
| 19 | parentheses within the pattern is used to compute the number of pairs of |
| 20 | offsets that are required in the match data block. These form the "output |
| 21 | vector" (ovector) within the match data block, and are used to identify the |
| 22 | matched string and any captured substrings when matching with |
| 23 | \fBpcre2_match()\fP. If you are using \fBpcre2_dfa_match()\fP, which uses the |
| 24 | outut vector in a different way, you should use \fBpcre2_match_data_create()\fP |
| 25 | instead of this function. |
| 26 | .P |
| 27 | The second argument points to a general context, for custom memory management, |
| 28 | or is NULL to use the same memory allocator as was used for the compiled |
| 29 | pattern. The result of the function is NULL if the memory for the block could |
| 30 | not be obtained. |
| 31 | .P |
| 32 | There is a complete description of the PCRE2 native API in the |
| 33 | .\" HREF |
| 34 | \fBpcre2api\fP |
| 35 | .\" |
| 36 | page and a description of the POSIX API in the |
| 37 | .\" HREF |
| 38 | \fBpcre2posix\fP |
| 39 | .\" |
| 40 | page. |