Skip to content

Commit c2216b2

Browse files
committed
fix: set 'rc' value for fill ovector correctly
1 parent eaba30f commit c2216b2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

standalone/regex.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ if (nmatch > 0)
171171
pcre2_match_data_free(match_data);
172172
pcre2_match_context_free(match_context);
173173
}
174+
/*
175+
pcre2_match() returns one more than the highest numbered capturing pair
176+
that has been set (for example, 1 if there are no captures) - see pcre2_match's manual
177+
*/
178+
rc = pcre2_ret - 1;
174179
}
175180
#else
176181
rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string),

0 commit comments

Comments
 (0)