blob: 37486dd550a1180da9e3afe3f16e809ba13949fa [file] [log] [blame]
Elliott Hughes5b808042021-10-01 10:56:10 -07001.TH PCRE2_MATCH_DATA_CREATE_FROM_PATTERN 3 "28 August 2021" "PCRE2 10.38"
2.SH NAME
3PCRE2 - 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
17This function creates a new match data block for holding the result of a match.
18The first argument points to a compiled pattern. The number of capturing
19parentheses within the pattern is used to compute the number of pairs of
20offsets that are required in the match data block. These form the "output
21vector" (ovector) within the match data block, and are used to identify the
22matched string and any captured substrings when matching with
23\fBpcre2_match()\fP. If you are using \fBpcre2_dfa_match()\fP, which uses the
24outut vector in a different way, you should use \fBpcre2_match_data_create()\fP
25instead of this function.
26.P
27The second argument points to a general context, for custom memory management,
28or is NULL to use the same memory allocator as was used for the compiled
29pattern. The result of the function is NULL if the memory for the block could
30not be obtained.
31.P
32There is a complete description of the PCRE2 native API in the
33.\" HREF
34\fBpcre2api\fP
35.\"
36page and a description of the POSIX API in the
37.\" HREF
38\fBpcre2posix\fP
39.\"
40page.