summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c2
-rw-r--r--t/op/re_tests12
2 files changed, 14 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index a15eb233de..f092e7e4c3 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -904,6 +904,8 @@ S_study_chunk(pTHX_ regnode **scanp, I32 *deltap, regnode *last, scan_data_t *da
} else {
/* start offset must point into the last copy */
data->last_start_min += minnext * (mincount - 1);
+ data->last_start_max += is_inf ? 0 : (maxcount - 1)
+ * (minnext + data->pos_delta);
}
}
/* It is counted once already... */
diff --git a/t/op/re_tests b/t/op/re_tests
index 8df1fc9f5f..38483253d3 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -756,6 +756,18 @@ tt+$ xxxtt y - -
^(.,){2}c a,b,c y $1 b,
^(?:[^,]*,){2}c a,b,c y - -
^([^,]*,){2}c a,b,c y $1 b,
+^([^,]*,){3}d aaa,b,c,d y $1 c,
+^([^,]*,){3,}d aaa,b,c,d y $1 c,
+^([^,]*,){0,3}d aaa,b,c,d y $1 c,
+^([^,]{1,3},){3}d aaa,b,c,d y $1 c,
+^([^,]{1,3},){3,}d aaa,b,c,d y $1 c,
+^([^,]{1,3},){0,3}d aaa,b,c,d y $1 c,
+^([^,]{1,},){3}d aaa,b,c,d y $1 c,
+^([^,]{1,},){3,}d aaa,b,c,d y $1 c,
+^([^,]{1,},){0,3}d aaa,b,c,d y $1 c,
+^([^,]{0,3},){3}d aaa,b,c,d y $1 c,
+^([^,]{0,3},){3,}d aaa,b,c,d y $1 c,
+^([^,]{0,3},){0,3}d aaa,b,c,d y $1 c,
(?i) y - -
'(?!\A)x'm a\nxb\n y - -
^(a(b)?)+$ aba y -$1-$2- -a--