From: Gurusamy Sarathy Date: Sat, 21 Dec 1996 02:59:22 +0000 (-0500) Subject: patch for regex bug: (x|x){n} X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=579cf2c30d1c2eed351c0a6945d08a57bdcd1f6b;p=p5sagit%2Fp5-mst-13.2.git patch for regex bug: (x|x){n} 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: <01IA10O8ZIB600219C@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> --- diff --git a/regexec.c b/regexec.c index 292f960..bed5a99 100644 --- a/regexec.c +++ b/regexec.c @@ -891,7 +891,7 @@ char *prog; /* 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))