tools/pcre/doc/pcre_get_named_substring.3
author Nicholas Hastings <skamonkey@gmail.com>
Sun Mar 17 11:32:03 2013 -0400 (2013-03-17)
changeset 3831 babd0eee3c5e
parent 2762 d2d467bf1b5a
permissions -rw-r--r--
Updated PCRE source to version 8.32 (bug 5593).
skamonkey@3831
     1
.TH PCRE_GET_NAMED_SUBSTRING 3 "24 June 2012" "PCRE 8.30"
dvander@2762
     2
.SH NAME
dvander@2762
     3
PCRE - Perl-compatible regular expressions
dvander@2762
     4
.SH SYNOPSIS
dvander@2762
     5
.rs
dvander@2762
     6
.sp
dvander@2762
     7
.B #include <pcre.h>
dvander@2762
     8
.PP
dvander@2762
     9
.SM
dvander@2762
    10
.B int pcre_get_named_substring(const pcre *\fIcode\fP,
dvander@2762
    11
.ti +5n
dvander@2762
    12
.B const char *\fIsubject\fP, int *\fIovector\fP,
dvander@2762
    13
.ti +5n
dvander@2762
    14
.B int \fIstringcount\fP, const char *\fIstringname\fP,
dvander@2762
    15
.ti +5n
dvander@2762
    16
.B const char **\fIstringptr\fP);
skamonkey@3831
    17
.PP
skamonkey@3831
    18
.B int pcre16_get_named_substring(const pcre16 *\fIcode\fP,
skamonkey@3831
    19
.ti +5n
skamonkey@3831
    20
.B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
skamonkey@3831
    21
.ti +5n
skamonkey@3831
    22
.B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
skamonkey@3831
    23
.ti +5n
skamonkey@3831
    24
.B PCRE_SPTR16 *\fIstringptr\fP);
skamonkey@3831
    25
.PP
skamonkey@3831
    26
.B int pcre32_get_named_substring(const pcre32 *\fIcode\fP,
skamonkey@3831
    27
.ti +5n
skamonkey@3831
    28
.B PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
skamonkey@3831
    29
.ti +5n
skamonkey@3831
    30
.B int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,
skamonkey@3831
    31
.ti +5n
skamonkey@3831
    32
.B PCRE_SPTR32 *\fIstringptr\fP);
dvander@2762
    33
.
dvander@2762
    34
.SH DESCRIPTION
dvander@2762
    35
.rs
dvander@2762
    36
.sp
dvander@2762
    37
This is a convenience function for extracting a captured substring by name. The
dvander@2762
    38
arguments are:
dvander@2762
    39
.sp
dvander@2762
    40
  \fIcode\fP          Compiled pattern
dvander@2762
    41
  \fIsubject\fP       Subject that has been successfully matched
skamonkey@3831
    42
  \fIovector\fP       Offset vector that \fBpcre[16|32]_exec()\fP used
skamonkey@3831
    43
  \fIstringcount\fP   Value returned by \fBpcre[16|32]_exec()\fP
dvander@2762
    44
  \fIstringname\fP    Name of the required substring
dvander@2762
    45
  \fIstringptr\fP     Where to put the string pointer
dvander@2762
    46
.sp
dvander@2762
    47
The memory in which the substring is placed is obtained by calling
skamonkey@3831
    48
\fBpcre[16|32]_malloc()\fP. The convenience function
skamonkey@3831
    49
\fBpcre[16|32]_free_substring()\fP can be used to free it when it is no longer
skamonkey@3831
    50
needed. The yield of the function is the length of the extracted substring,
skamonkey@3831
    51
PCRE_ERROR_NOMEMORY if sufficient memory could not be obtained, or
skamonkey@3831
    52
PCRE_ERROR_NOSUBSTRING if the string name is invalid.
dvander@2762
    53
.P
dvander@2762
    54
There is a complete description of the PCRE native API in the
dvander@2762
    55
.\" HREF
dvander@2762
    56
\fBpcreapi\fP
dvander@2762
    57
.\"
dvander@2762
    58
page and a description of the POSIX API in the
dvander@2762
    59
.\" HREF
dvander@2762
    60
\fBpcreposix\fP
dvander@2762
    61
.\"
dvander@2762
    62
page.