From: Ilya Zakharevich <ilya@math.berkeley.edu>
Date: Tue, 10 Feb 1998 02:57:46 +0000 (-0500)
Subject: 5.004_5*: [PATCH] restore old behaviour of \1 in RE
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=af3f8c16b7d4e5efdb489a6f2ca99936245fc279;p=p5sagit%2Fp5-mst-13.2.git

5.004_5*: [PATCH] restore old behaviour of \1 in RE

p4raw-id: //depot/perl@505
---

diff --git a/regexec.c b/regexec.c
index 5fe5e4b..b11bb9a 100644
--- a/regexec.c
+++ b/regexec.c
@@ -979,7 +979,7 @@ regmatch(regnode *prog)
 	    n = ARG(scan);  /* which paren pair */
 	    s = regstartp[n];
 	    if (*reglastparen < n || !s)
-		break;			/* Zero length always matches */
+		sayNO;			/* Do not match unless seen CLOSEn. */
 	    if (s == regendp[n])
 		break;
 	    /* Inline the first character, for speed. */
diff --git a/t/op/re_tests b/t/op/re_tests
index 121e964..9217fcc 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -322,9 +322,9 @@ a(?:b|(c|e){1,2}?|d)+?(.)	ace	y	$1$2	ce
 ^(a\1?){4}$	aaaaaaaaaa	y	$1	aaaa
 ^(a\1?){4}$	aaaaaaaaa	n	-	-
 ^(a\1?){4}$	aaaaaaaaaaa	n	-	-
-^(a\1){4}$	aaaaaaaaaa	y	$1	aaaa
-^(a\1){4}$	aaaaaaaaa	n	-	-
-^(a\1){4}$	aaaaaaaaaaa	n	-	-
+^(a(?(1)\1)){4}$	aaaaaaaaaa	y	$1	aaaa
+^(a(?(1)\1)){4}$	aaaaaaaaa	n	-	-
+^(a(?(1)\1)){4}$	aaaaaaaaaaa	n	-	-
 (?:(f)(o)(o)|(b)(a)(r))*	foobar	y	$1:$2:$3:$4:$5:$6	f:o:o:b:a:r
 (?<=a)b	ab	y	$&	b
 (?<=a)b	cb	n	-	-