From: Ilya Zakharevich Date: Fri, 21 Aug 1998 05:41:02 +0000 (-0400) Subject: make behavior of /(a{3})+/ like /(aaa)+/ w.r.t where it matches X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=708e3b054d184f1df89a7417419acad25ffa7318;p=p5sagit%2Fp5-mst-13.2.git make behavior of /(a{3})+/ like /(aaa)+/ w.r.t where it matches Message-Id: <199808210941.FAA16467@monk.mps.ohio-state.edu> Subject: Re: your mail p4raw-id: //depot/perl@1815 --- diff --git a/regexec.c b/regexec.c index 0627e2b..2dac18d 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 d1b1cec..8bd175d 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 - -