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