PCRE2_SUBSTRING_LENGTH_BYNUMBER(3)

🌸 NAME

hiii bestie, welcome to the PCRE2_SUBSTRING_LENGTH_BYNUMBER(3) page, direct from the Library Functions Manual β€” yes, the title and manual-name situation are folded right in here so we can get to the good stuff ✨

PCRE2 β€” Perl-compatible regular expressions (revised API).

✨ SYNOPSIS

okay so here's the exact summoning ritual:

#include <pcre2.h>

int pcre2_substring_length_bynumber(pcre2_match_data *match_data,
  uint32_t number, PCRE2_SIZE *length);

πŸ’– DESCRIPTION

This function is your go-to for finding the length of a matched substring, and you point at the substring by number. Here's what the arguments are doing:

  • match_data β€” the match data block for the match. literally the match's whole little data situation πŸ’…
  • number β€” the substring number, aka which captured substring you're asking about.
  • length β€” where to return the length, or NULL.

You can pass NULL as that third argument if all you're trying to find out is whether or not a substring is set. Like, no cap, sometimes you just need the yes/no vibe.

On success the yield is 0; otherwise you get a negative error code. So 0 is the slay result, negative is the "something went sideways" result 😭

After a partial match, substring 0 is literally the only one available.

For the full breakdown of the PCRE2 native API, hit the pcre2api page; the POSIX API description lives in the pcre2posix page. Go off, bestie πŸ“šβœ¨


mwah πŸ’‹ that's the whole page: PCRE2 10.47, dated 22 December 2014 β€” footer info but make it cute, periodt.

πŸ“¦ where this page comes from