PCRE2_SUBS...GET_BYNAME(3)
π NAME π
okay so bestie, welcome to the PCRE2 Library Functions Manual page for PCRE2_SUBS...GET_BYNAME(3) β¨ The official NAME line is literally PCRE2 - Perl-compatible regular expressions (revised API). That's the whole vibe: PCRE2, revised API, here to help you regex π
π SYNOPSIS π
#include <pcre2.h>
int pcre2_substring_get_byname(pcre2_match_data *match_data,
PCRE2_SPTR name, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen);
π¦ DESCRIPTION π¦
This is a convenience function for extracting a captured substring by name into newly acquired memory. Think: you know the group's name, not its number, and you want that substring copied into fresh memory that belongs to you β main character energy π«Ά
The arguments are:
match_dataβ the match data for the matchnameβ name of the required substringbufferptrβ where to put the string pointerbufflenβ where to put the string length
The memory where the substring lands is obtained by calling the same memory allocation function that was used for the match data block. When it is no longer needed, the convenience function pcre2_substring_free() can be used to free it. (Free your fave, bestie, don't ghost that memory π)
The yield of the function is zero for success, or one of these error numbers:
PCRE2_ERROR_NOSUBSTRINGβ there are no groups of that namePCRE2_ERROR_UNAVAILBLEβ the ovector was too small for that groupPCRE2_ERROR_UNSETβ the group did not participate in the matchPCRE2_ERROR_NOMEMORYβ memory could not be obtained
If there is more than one group with the given name, the first one that is set is returned. In this situation, PCRE2_ERROR_UNSET means that no group with the given name was set.
There's a complete description of the PCRE2 native API on the pcre2api page, and a description of the POSIX API on the pcre2posix page. Go read those if you want the full lore πβ¨
That's the whole page, bestie: PCRE2 10.47, dated 19 December 2014, xoxo π
π¦ where this page comes from
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms