Once pcre2_match() is successfully executed I use pcre2_get_ovector_pointer() to get the ovector and then build a data structure containing (1) the matched string (using ovector[0] and ovector[1]); and (2) the matched capture groups (using ovector[2*i] and ovector[2*i+1], for i in [1..rv), where rv is the return value of pcre2_match()).
For each capture group number, I'd like to include in the data structure the matched string (no problem, that's in ovector), the length of the match (same, the info can be extracted form ovector), and, and this is the difficulty, the name of the capture group (obviously, only if the matched group has a name).
Helper functions are available to fetch matched capture groups by name. In particular pcre2_substring_number_from_name() could be used to transform a capture group name into a group number (i.e name-to-number translation). What I need in the exact opposite behaviour: given a group number, get its associated group name, if any, or NULL otherwise (i.e. number-to-name translation). I assume I missing something obvious here, but I'm not able to find a way to do that using the PCRE2 API. Is it possible?