PCRE2_GET_STARTCHAR(3)

πŸŽ€ NAME πŸŽ€

hey bestie, welcome to the PCRE2_GET_STARTCHAR(3) page from the Library Functions Manual β€” it's all about PCRE2 β€” Perl-compatible regular expressions (revised API) πŸ’–βœ¨


🌸 SYNOPSIS 🌸

okay so here's the whole signature, no cap:

#include <pcre2.h>

PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *match_data);

that's literally it. iconic. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so picture this: you already called pcre2_match() and it succeeded, and you passed it the match block that is this function's argument. after that, pcre2_get_startchar() returns the code unit offset of the character at which the successful match started. slay. ✨

for a non-partial match, this can be different to the value of ovector[0] if the pattern contains the \K escape sequence. yes, \K is the little plot twist here πŸ‘€πŸ’€

but after a partial match? nope, no \K chaos: this value is always the same as ovector[0], because \K does not affect the result of a partial match. periodt. 🫢

there is a complete description of the PCRE2 native API in the pcre2api page, and a description of the POSIX API in the pcre2posix page. go read those if you want the full lore, bestie πŸ“šπŸ’–

no cap: the \K detail is the whole vibe check here β€” if the match is non-partial, start-char can disagree with ovector[0]; if it's partial, they're matching. πŸ”₯

that's the whole page, bestie! brought to you by PCRE2 10.47, dated 25 October 2014, and the manual page name is PCRE2_GET_STARTCHAR(3) β€” byeeee πŸ’…πŸŽ€πŸ’–

πŸ“¦ where this page comes from