From: Hugo van der Sanden Date: Wed, 9 Jan 2002 13:37:17 +0000 (+0000) Subject: Re: [ID 20020109.002] /(?m:...\s*$)/ is not backtracking properly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ac24cf0d3ccfc0335a07abaf314aaac1d49705f;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20020109.002] /(?m:...\s*$)/ is not backtracking properly Message-Id: <200201091337.g09DbH519379@crypt.compulink.co.uk> p4raw-id: //depot/perl@14149 --- diff --git a/regexec.c b/regexec.c index 3e6ba65..1bc9983 100644 --- 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/. diff --git a/t/op/re_tests b/t/op/re_tests index 1555610..5816601 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -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