blob: d2af63bf7287fe309e32d49168c72fb636cece05 [file] [log] [blame]
Janis Danisevskis112c9cc2016-03-31 13:35:25 +01001.TH PCRE2_SUBSTRING_COPY_BYNAME 3 "21 October 2014" "PCRE2 10.00"
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 int pcre2_substring_copy_byname(pcre2_match_data *\fImatch_data\fP,
11.B " PCRE2_SPTR \fIname\fP, PCRE2_UCHAR *\fIbuffer\fP, PCRE2_SIZE *\fIbufflen\fP);"
12.fi
13.
14.SH DESCRIPTION
15.rs
16.sp
17This is a convenience function for extracting a captured substring, identified
18by name, into a given buffer. The arguments are:
19.sp
20 \fImatch_data\fP The match data block for the match
21 \fIname\fP Name of the required substring
22 \fIbuffer\fP Buffer to receive the string
23 \fIbufflen\fP Length of buffer (code units)
24.sp
25The \fIbufflen\fP variable is updated to contain the length of the extracted
26string, excluding the trailing zero. The yield of the function is zero for
27success or one of the following error numbers:
28.sp
29 PCRE2_ERROR_NOSUBSTRING there are no groups of that name
30 PCRE2_ERROR_UNAVAILBLE the ovector was too small for that group
31 PCRE2_ERROR_UNSET the group did not participate in the match
32 PCRE2_ERROR_NOMEMORY the buffer is not big enough
33.sp
34If there is more than one group with the given name, the first one that is set
35is returned. In this situation PCRE2_ERROR_UNSET means that no group with the
36given name was set.
37.P
38There is a complete description of the PCRE2 native API in the
39.\" HREF
40\fBpcre2api\fP
41.\"
42page and a description of the POSIX API in the
43.\" HREF
44\fBpcre2posix\fP
45.\"
46page.