summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regexec.c8
-rw-r--r--t/op/re_tests3
2 files changed, 7 insertions, 4 deletions
diff --git a/regexec.c b/regexec.c
index 0627e2b154..2dac18d95a 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2546,14 +2546,14 @@ regrepeat_hard(regnode *p, I32 max, I32 *lp)
register char *start;
register char *loceol = PL_regeol;
I32 l = 0;
- I32 count = 0;
+ I32 count = 0, res = 1;
if (!max)
return 0;
start = PL_reginput;
if (UTF) {
- while (PL_reginput < loceol && (scan = PL_reginput, regmatch(p))) {
+ while (PL_reginput < loceol && (scan = PL_reginput, res = regmatch(p))) {
if (!count++) {
l = 0;
while (start < PL_reginput) {
@@ -2569,7 +2569,7 @@ regrepeat_hard(regnode *p, I32 max, I32 *lp)
}
}
else {
- while (PL_reginput < loceol && (scan = PL_reginput, regmatch(p))) {
+ while (PL_reginput < loceol && (scan = PL_reginput, res = regmatch(p))) {
if (!count++) {
*lp = l = PL_reginput - start;
if (max != REG_INFTY && l*max < loceol - scan)
@@ -2579,7 +2579,7 @@ regrepeat_hard(regnode *p, I32 max, I32 *lp)
}
}
}
- if (PL_reginput < loceol)
+ if (!res)
PL_reginput = scan;
return count;
diff --git a/t/op/re_tests b/t/op/re_tests
index d1b1cecba8..8bd175d52d 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -335,6 +335,9 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce
^(a(?(1)\1)){4}$ aaaaaaaaaa y $1 aaaa
^(a(?(1)\1)){4}$ aaaaaaaaa n - -
^(a(?(1)\1)){4}$ aaaaaaaaaaa n - -
+((a{4})+) aaaaaaaaa y $1 aaaaaaaa
+(((aa){2})+) aaaaaaaaaa y $1 aaaaaaaa
+(((a{2}){2})+) aaaaaaaaaa y $1 aaaaaaaa
(?:(f)(o)(o)|(b)(a)(r))* foobar y $1:$2:$3:$4:$5:$6 f:o:o:b:a:r
(?<=a)b ab y $& b
(?<=a)b cb n - -