PCRE_GET_S...LE_ENTRIES(3)

🌸 PCRE_GET_S...LE_ENTRIES(3) 🌸

okay bestie, so this is a page from the Library Functions Manual for PCRE β€” that's Perl-compatible regular expressions β€” and we're about to get into the string-table lore. πŸ’…


✨ NAME ✨

PCRE β€” Perl-compatible regular expressions πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <pcre.h>

int pcre_get_stringtable_entries(const pcre *code,
     const char *name, char **first, char **last);

int pcre16_get_stringtable_entries(const pcre16 *code,
     PCRE_SPTR16 name, PCRE_UCHAR16 **first, PCRE_UCHAR16 **last);

int pcre32_get_stringtable_entries(const pcre32 *code,
     PCRE_SPTR32 name, PCRE_UCHAR32 **first, PCRE_UCHAR32 **last);

no cap, three flavors: 8-bit, 16-bit, 32-bit. pick your fighter. πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so this convenience function is literally the friend that finds things for you. 🫢 for a compiled pattern, it finds the first and last entries for a given name in the table that translates capturing parenthesis names into numbers.

when names are required to be unique (aka PCRE_DUPNAMES is not set), it's usually easier to just use pcre[16|32]_get_stringnumber() instead. fr fr, save yourself the trouble. 😌

here's the lil parameter rundown, bestie:

  • code β€” the compiled regular expression πŸ‘‘
  • name β€” the name whose entries you're looking for
  • first β€” where to return a pointer to the first entry
  • last β€” where to return a pointer to the last entry

the yield of the function (the thing it gives back) is the length of each entry, or PCRE_ERROR_NOSUBSTRING if none are found. 😭 so if you get that error, it's giving "girl, there's nothing here."


and if you want the full tea: there's a complete description of the PCRE native API β€” including the format of the table entries β€” in the pcreapi page, plus a description of the POSIX API in the pcreposix page. go read those, iykyk. πŸ“šβœ¨


that's the whole vibe, bestie β€” go slay some regexes πŸ’–

this was PCRE 8.30, dated 24 June 2012 🌈✨