PCRE2_SUBS...TABLE_SCAN(3)

okay bestie, welcome to the Library Functions Manual page for PCRE2_SUBS...TABLE_SCAN(3) πŸ’… this one is short but iconic.

πŸ’– NAME πŸ’–

PCRE2 - Perl-compatible regular expressions (revised API) ✨

✨ SYNOPSIS ✨

this is the whole vibe, bestie:

#include <pcre2.h>

int pcre2_substring_nametable_scan(const pcre2_code *code,
  PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this is a convenience function, and it does one very specific little job: for a compiled pattern, it finds the first and last entries for a given name in the table that translates capture group names into numbers. lowkey useful, no cap πŸ’œ

πŸŽ€ the args πŸŽ€

  • code β€” Compiled regular expression πŸ‘‘
  • name β€” Name whose entries required πŸ”
  • first β€” Where to return a pointer to the first entry 🫢
  • last β€” Where to return a pointer to the last entry 🫢

🌸 what it returns, bestie 🌸

When the name is found in the table:

  • if first is NULL, the function returns a group number 😌 but if there is more than one matching entry, it is not defined which one πŸ’€ (so don't act brand new about it).
  • otherwise, when both pointers have been set, the yield of the function is the length of each entry in code units πŸ“.

If the name is not found, PCRE2_ERROR_NOSUBSTRING is returned πŸ™ˆ.

πŸ’œ where to learn more πŸ’œ

There is a complete description of the PCRE2 native API, including the format of the table entries, in the pcre2api page, and a description of the POSIX API in the pcre2posix page. go read those if you want the full lore πŸ“šβœ¨


mwah πŸ’‹ this cutie is from PCRE2 10.47, dated 06 February 2019, and its whole title is PCRE2_SUBS...TABLE_SCAN(3) β€” Library Functions Manual bestie forever πŸ«ΆπŸ’–

πŸ“¦ where this page comes from