fix: set 'rc' value for fill ovector correctly

This commit is contained in:
Ervin Hegedus 2025-05-10 13:34:56 +02:00
parent eaba30f1c7
commit c2216b2616
No known key found for this signature in database
GPG Key ID: 5FA5BC3F5EC41F61

View File

@ -171,6 +171,11 @@ if (nmatch > 0)
pcre2_match_data_free(match_data);
pcre2_match_context_free(match_context);
}
/*
pcre2_match() returns one more than the highest numbered capturing pair
that has been set (for example, 1 if there are no captures) - see pcre2_match's manual
*/
rc = pcre2_ret - 1;
}
#else
rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string),