We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7b73e78 + aecb4a2 commit 4bb5f7cCopy full SHA for 4bb5f7c
libpromises/matching.c
@@ -50,6 +50,16 @@ static char *FirstBackReference(Regex *regex, const char *teststring)
50
* negative numbers are errors (incl. no match). */
51
if (result > 0)
52
{
53
+ uint32_t num_pairs = pcre2_get_ovector_count(match_data);
54
+ if (num_pairs <= 1)
55
+ {
56
+ /* There was no match */
57
+ strlcpy(backreference, "CF_NOMATCH", CF_MAXVARSIZE);
58
+ pcre2_match_data_free(match_data);
59
+ RegexDestroy(regex);
60
+ return backreference;
61
+ }
62
+
63
size_t *ovector = pcre2_get_ovector_pointer(match_data);
64
/* ovector[0] and ovector[1] are for the start and end of the whole
65
* match, the capture groups follow in [2] and [3], etc. */
0 commit comments