This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [ID 20020109.002] /(?m:...\s*$)/ is not backtracking properly
authorHugo van der Sanden <hv@crypt.org>
Wed, 9 Jan 2002 13:37:17 +0000 (13:37 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 9 Jan 2002 13:47:31 +0000 (13:47 +0000)
Message-Id: <200201091337.g09DbH519379@crypt.compulink.co.uk>

p4raw-id: //depot/perl@14149

regexec.c
t/op/re_tests

index 3e6ba65..1bc9983 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3586,7 +3586,7 @@ S_regmatch(pTHX_ regnode *prog)
                n = regrepeat(scan, n);
                locinput = PL_reginput;
                if (ln < n && PL_regkind[(U8)OP(next)] == EOL &&
-                   (!PL_multiline  || OP(next) == SEOL || OP(next) == EOS)) {
+                   ((!PL_multiline && OP(next) != MEOL) || OP(next) == SEOL || OP(next) == EOS)) {
                    ln = n;                     /* why back off? */
                    /* ...because $ and \Z can match before *and* after
                       newline at the end.  Consider "\n\n" =~ /\n+\Z\n/.
index 1555610..5816601 100644 (file)
@@ -798,3 +798,4 @@ ab(?i)cd    abCd    y       -       -
 (A|B)*?(?(1)(CD)|(CD)) ABCD    y       $2-$3   CD-
 '^(o)(?!.*\1)'i        Oo      n       -       -
 (.*)\d+\1      abc12bc y       $1      bc
+(?m:(foo\s*$)) foo\n bar       y       $1      foo