From: Hugo van der Sanden <hv@crypt.org>
Date: Tue, 11 Jul 2000 12:44:50 +0000 (+0100)
Subject: [ID 20000701.002] Regular Expressions Not Unsetting $1 Vars When Backtracking
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f06a1d4e6ae96bf8af49f0ef1c79f500d8de0143;p=p5sagit%2Fp5-mst-13.2.git

[ID 20000701.002] Regular Expressions Not Unsetting $1 Vars When Backtracking
Message-Id: <200007111144.MAA04446@crypt.compulink.co.uk>

p4raw-id: //depot/cfgperl@6337
---

diff --git a/regexec.c b/regexec.c
index 49a081f..6bddf2d 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3001,6 +3001,8 @@ S_regmatch(pTHX_ regnode *prog)
 	    else
 		c1 = c2 = -1000;
 	    PL_reginput = locinput;
+	    if (paren)
+		PL_regendp[paren] = -1;
 	    if (minmod) {
 		CHECKPOINT lastcp;
 		minmod = 0;
diff --git a/t/op/re_tests b/t/op/re_tests
index 37e8ee3..263bded 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -750,5 +750,6 @@ tt+$	xxxtt	y	-	-
 ^([a-z]:)	C:/	n	-	-
 '^\S\s+aa$'m	\nx aa	y	-	-
 (^|a)b	ab	y	-	-
+^([ab]*?)(b)?(c)$	abac	y	-$2-	--
 (?i)		y	-	-
 '(?!\A)x'm	a\nxb\n	y	-	-