develooper Front page | perl.perl5.porters | Postings from July 2000

[ID 20000731.010] regex error

Thread Next
From:
mjd
Date:
July 31, 2000 22:45
Subject:
[ID 20000731.010] regex error
Message ID:
20000801054500.6470.qmail@plover.com
Path: newshog.newsread.com!bad-news.newsread.com!netaxs.com!newsread.com!news.misty.com!news.pir.net!panix!newsfeed.mathworks.com!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.rdc1.tx.home.com.POSTED!not-for-mail
From: Doug Harrison <dsh@mvps.org>
Newsgroups: comp.lang.perl.misc
Subject: Possible regex regression in 5.6.0
Message-ID: <1evbosgj5q2jb1n3rrbhk5ttl43dm58tdc@4ax.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 52
Date: Mon, 31 Jul 2000 22:35:48 GMT
NNTP-Posting-Host: 24.21.224.10
X-Complaints-To: abuse@home.net
X-Trace: news1.rdc1.tx.home.com 965082948 24.21.224.10 (Mon, 31 Jul 2000 15:35:48 PDT)
NNTP-Posting-Date: Mon, 31 Jul 2000 15:35:48 PDT
Organization: @Home Network
Xref: bad-news.newsread.com comp.lang.perl.misc:333655

Consider the following program:

{
   $x = "1\nabcabcabcabc\n";
   print "match 1\n" if $x =~ /^.{9}abc.*\n/m;
}

{
   $x = "12\nabcabcabcabc\n";
   print "match 2\n" if $x =~ /^.{9}abc.*\n/m;
}

{
   # Fails in Perl 5.6.0
   $x = "123\nabcabcabcabc\n";
   print "match 3\n" if $x =~ /^.{9}abc.*\n/m;
}

{
   # Replacing penultimate 'c' with 'X' fixes it
   $x = "123\nabcabcabXabc\n";
   print "match 4\n" if $x =~ /^.{9}abc.*\n/m;
}

{
   # Replacing .* with .? fixes it
   $x = "123\nabcabcabcabc\n";
   print "match 5\n" if $x =~ /^.{9}abc.?\n/m;
}

Under 5.005_03, the output is:

match 1
match 2
match 3
match 4
match 5

Under 5.6.0 (ActivePerl build 616), the output is:

match 1
match 2
match 4
match 5

I don't see why 5.6.0 failed on match 3. Any ideas?



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About