diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-19 17:33:59 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-19 17:33:59 +0000 |
commit | 1aeab75ab913b2442f1de7300d375422255ad122 (patch) | |
tree | 8f24e16b46838bf5ab71c8e0a10feb37319d76b2 /regexec.c | |
parent | 87d7fd28459b8274079ce3260d3e07e306aa70d8 (diff) | |
download | perl-1aeab75ab913b2442f1de7300d375422255ad122.tar.gz |
fix bug in backtracking optimizer (from Makoto Ishisone
<ishisone@sra.co.jp>)
p4raw-id: //depot/perl@5151
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -3045,8 +3045,14 @@ 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)) + (!PL_multiline || 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/. + We should back off by one in this case. */ + if (UCHARAT(PL_reginput - 1) == '\n' && OP(next) != EOS) + ln--; + } REGCP_SET; if (paren) { while (n >= ln) { |