From: Ilya Zakharevich Date: Wed, 5 Jan 2000 15:23:18 +0000 (-0500) Subject: Re: minimal m//g matches appear busted X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d506a20dca04253441c06a876baccc8c83469e95;p=p5sagit%2Fp5-mst-13.2.git Re: minimal m//g matches appear busted Message-Id: <20000105152318.A7400@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@4759 --- diff --git a/regexec.c b/regexec.c index 4a674a8..0bd9da8 100644 --- a/regexec.c +++ b/regexec.c @@ -639,7 +639,10 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, /* Even in this situation we may use MBOL flag if strpos is offset wrt the start of the string. */ if (ml_anch && sv - && (strpos + SvCUR(sv) != strend) && strpos[-1] != '\n') { + && (strpos + SvCUR(sv) != strend) && strpos[-1] != '\n' + /* May be due to an implicit anchor of m{.*foo} */ + && !(prog->reganch & ROPT_IMPLICIT)) + { t = strpos; goto find_anchor; } diff --git a/t/op/pat.t b/t/op/pat.t index 5c564aa..9f68550 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -4,7 +4,7 @@ # the format supported by op/regexp.t. If you want to add a test # that does fit that format, add it to op/re_tests, not here. -print "1..194\n"; +print "1..195\n"; BEGIN { chdir 't' if -d 't'; @@ -898,3 +898,10 @@ $text = "xA\n" x 500; $text =~ /^\s*A/m and print 'not '; print "ok $test\n"; $test++; + +$text = "abc dbf"; +@res = ($text =~ /.*?(b).*?\b/g); +"@res" eq 'b b' or print 'not '; +print "ok $test\n"; +$test++; +