1PCRE_GET_NAMED_SUBSTRING(3)Library Functions ManualPCRE_GET_NAMED_SUBSTRING(3)
2
3
4
6 PCRE - Perl-compatible regular expressions
7
9
10 #include <pcre.h>
11
12 int pcre_get_named_substring(const pcre *code,
13 const char *subject, int *ovector,
14 int stringcount, const char *stringname,
15 const char **stringptr);
16
17 int pcre16_get_named_substring(const pcre16 *code,
18 PCRE_SPTR16 subject, int *ovector,
19 int stringcount, PCRE_SPTR16 stringname,
20 PCRE_SPTR16 *stringptr);
21
22 int pcre32_get_named_substring(const pcre32 *code,
23 PCRE_SPTR32 subject, int *ovector,
24 int stringcount, PCRE_SPTR32 stringname,
25 PCRE_SPTR32 *stringptr);
26
28
29 This is a convenience function for extracting a captured substring by
30 name. The arguments are:
31
32 code Compiled pattern
33 subject Subject that has been successfully matched
34 ovector Offset vector that pcre[16|32]_exec() used
35 stringcount Value returned by pcre[16|32]_exec()
36 stringname Name of the required substring
37 stringptr Where to put the string pointer
38
39 The memory in which the substring is placed is obtained by calling
40 pcre[16|32]_malloc(). The convenience function pcre[16|32]_free_sub‐
41 string() can be used to free it when it is no longer needed. The yield
42 of the function is the length of the extracted substring,
43 PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
44 PCRE_ERROR_NOSUBSTRING if the string name is invalid.
45
46 There is a complete description of the PCRE native API in the pcreapi
47 page and a description of the POSIX API in the pcreposix page.
48
49
50
51PCRE 8.30 24 June 2012 PCRE_GET_NAMED_SUBSTRING(3)