From 579cf2c30d1c2eed351c0a6945d08a57bdcd1f6b Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Fri, 20 Dec 1996 21:59:22 -0500 Subject: [PATCH] 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> --- regexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) -- 2.7.4