Change 14149 by jhi@alpha on 2002/01/09 13:47:31
Subject: Re: [ID 20020109.002] /(?m:...\s*$)/ is not backtracking properly
From: Hugo van der Sanden <[EMAIL PROTECTED]>
Date: Wed, 09 Jan 2002 13:37:17 +0000
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/regexec.c#247 edit
.... //depot/perl/t/op/re_tests#73 edit
Differences ...
==== //depot/perl/regexec.c#247 (text) ====
Index: perl/regexec.c
--- perl/regexec.c.~1~ Wed Jan 9 07:00:06 2002
+++ perl/regexec.c Wed Jan 9 07:00:06 2002
@@ -3586,7 +3586,7 @@
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/.
==== //depot/perl/t/op/re_tests#73 (text) ====
Index: perl/t/op/re_tests
--- perl/t/op/re_tests.~1~ Wed Jan 9 07:00:06 2002
+++ perl/t/op/re_tests Wed Jan 9 07:00:06 2002
@@ -798,3 +798,4 @@
(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
End of Patch.