Regexp fix: (?>a+)b doesn't match aaab:
Ilya Zakharevich [Fri, 19 Dec 1997 16:02:50 +0000 (11:02 -0500)]
Subject: Re: Regexp [PATCH] 5.004_56 (?>...)

p4raw-id: //depot/perl@399

regexec.c
t/op/re_tests

index 7285bea..5fe5e4b 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1576,8 +1576,10 @@ regmatch(regnode *prog)
                logical = 0;
                sw = 1;
            }
-           if (OP(scan) == SUSPEND)
+           if (OP(scan) == SUSPEND) {
                locinput = reginput;
+               nextchar = UCHARAT(locinput);
+           }
            /* FALL THROUGH. */
        case LONGJMP:
          do_longjump:
index 29a6518..b688a16 100644 (file)
@@ -430,4 +430,7 @@ $(?<=^(a))  a       y       $1      a
 (?{$a=2})a*aa(?{local$a=$a+1})k*c(?{$b=$a})    yaaxxaaaacd     y       $b      3
 (?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a})  yaaxxaaaacd     y       $b      4
 (>a+)ab        aaab    n       -       -
+(?>a+)b        aaab    y       -       -
+((?>a+)b)      aaab    y       $1      aaab
+(?>(a+))b      aaab    y       $1      aaa
 ((?>[^()]+)|\([^()]*\))+       ((abc(ade)ufh()()x      y       $&      abc(ade)ufh()()x