1PCRE2_SUBSTRING_LIST_GET(3)Library Functions ManualPCRE2_SUBSTRING_LIST_GET(3)
2
3
4
6 PCRE2 - Perl-compatible regular expressions (revised API)
7
9
10 #include <pcre2.h>
11
12 int pcre2_substring_list_get(pcre2_match_data *match_data,
13 PCRE2_UCHAR ***listptr, PCRE2_SIZE **lengthsptr);
14
16
17 This is a convenience function for extracting all the captured sub‐
18 strings after a pattern match. It builds a list of pointers to the
19 strings, and (optionally) a second list that contains their lengths (in
20 code units), excluding a terminating zero that is added to each of
21 them. All this is done in a single block of memory that is obtained
22 using the same memory allocation function that was used to get the
23 match data block. The convenience function pcre2_substring_list_free()
24 can be used to free it when it is no longer needed. The arguments are:
25
26 match_data The match data block
27 listptr Where to put a pointer to the list
28 lengthsptr Where to put a pointer to the lengths, or NULL
29
30 A pointer to a list of pointers is put in the variable whose address is
31 in listptr. The list is terminated by a NULL pointer. If lengthsptr is
32 not NULL, a matching list of lengths is created, and its address is
33 placed in lengthsptr. The yield of the function is zero on success or
34 PCRE2_ERROR_NOMEMORY if sufficient memory could not be obtained.
35
36 There is a complete description of the PCRE2 native API in the pcre2api
37 page and a description of the POSIX API in the pcre2posix page.
38
39
40
41PCRE2 10.00 21 October 2014 PCRE2_SUBSTRING_LIST_GET(3)