summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@engin.umich.edu>1996-12-20 21:59:22 -0500
committerChip Salzenberg <chip@atlantic.net>1996-12-23 12:58:58 +1200
commit579cf2c30d1c2eed351c0a6945d08a57bdcd1f6b (patch)
treec4e4dd7a5803a0e0b5f4b9d664f36c6b9372f945
parentb2b8e269a606666f8c956ef04b81b71188e99229 (diff)
downloadperl-579cf2c30d1c2eed351c0a6945d08a57bdcd1f6b.tar.gz
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>
-rw-r--r--regexec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 292f96005d..bed5a998f1 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))