5.004_5*: [PATCH] restore old behaviour of \1 in RE
authorIlya Zakharevich <ilya@math.berkeley.edu>
Tue, 10 Feb 1998 02:57:46 +0000 (21:57 -0500)
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>
Thu, 12 Feb 1998 16:24:26 +0000 (16:24 +0000)
p4raw-id: //depot/perl@505

regexec.c
t/op/re_tests

index 5fe5e4b..b11bb9a 100644 (file)
--- 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. */
index 121e964..9217fcc 100644 (file)
@@ -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       -       -