On Mon, 16 Dec 1996 18:04:08 EST, I wrote:
>
>7. Symmetry confounds quantified regex alternation
>
>A well-researched bug report sent in by Charles Bailey:
>
> Message-Id: <01IA10O8ZI
B600219C@hmivax.humgen.upenn.edu>,
> Subject: Regex bug: (x|x){n}
>
>Pity I didn't have time to take a closer look at that one.
Here's a patch for the problem reported in the reference above.
Simpler test cases:
% perl -we '$_ = "atatttta"; print "|$1|$2|\n" if /((t|t){3})/;'
says "|t||" instead of instead of "|ttt|t|"; and
% perl -we '$_ = "atatttta"; print "|$1|$2|\n" if /((t|t){3,})/;'
says "|t||" instead of instead of "|tttt|t|"; and
p5p-msgid: <
199612210259.VAA10170@aatma.engin.umich.edu>
/* If degenerate scan matches "", assume scan done. */
- if (locinput == cc->lastloc) {
+ if (locinput == cc->lastloc && n >= cc->min) {
regcc = cc->oldcc;
ln = regcc->cur;
if (regmatch(cc->next))