PCRE2_SUBS..._FROM_NAME(3)

πŸ’… NAME πŸ’…

okay bestie, welcome to the manual page for PCRE2_SUBS..._FROM_NAME(3) in the Library Functions Manual β€” it’s giving PCRE2 - Perl-compatible regular expressions (revised API). ✨

🫢 SYNOPSIS 🫢

#include <pcre2.h>

int pcre2_substring_number_from_name(const pcre2_code *code,
  PCRE2_SPTR name);

🌸 DESCRIPTION 🌸

so this convenience function is literally here to find the number of a named substring capturing parenthesis in a compiled pattern β€” but only if that name is unique. no cap. πŸŽ€

the function arguments are:

  • code β€” compiled regular expression
  • name β€” name whose number is required

the yield of the function is the number of the parenthesis if the name is found, or PCRE2_ERROR_NOSUBSTRING if it is not found. when duplicate names are allowed (PCRE2_DUPNAMES is set), if the name is not unique, PCRE2_ERROR_NOUNIQUESUBSTRING is returned. you can obtain the list of numbers with the same name by calling pcre2_substring_nametable_scan(). πŸ’–

there’s a complete description of the PCRE2 native API in the pcre2api page, and a description of the POSIX API in the pcre2posix page. iykyk. πŸ¦‹


and that’s the whole page, bestie πŸ’… source/version is PCRE2 10.47, dated 03 November 2014, and it’s the PCRE2_SUBS..._FROM_NAME(3) manual page β€” periodt. πŸ’‹

πŸ“¦ where this page comes from