Re: is "\S+\s*$" with MULTILINE_MASK broken?

"Daniel F. Savarese" <[email protected]>
Newsgroups gmane.comp.jakarta.oro.devel
Message-ID <[email protected]>
In message <3EC3A459.26823.1515EC7@localhost>, "Anders Cederlund" writes:
>"\S+\s*$" and "\S+ *$" does not match the same string.
...
>So... bug, feature?

Not sure.  Correct results are:

~> perl -e '$input = " aaa bbb \n ccc ddd \n eee fff "; @matches = ($input =~ m/\S+ *$/gm); for my $match (@matches) { print "|$match|\n"; }'
|bbb |
|ddd |
|fff |

~> perl -e '$input = " aaa bbb \n ccc ddd \n eee fff "; @matches = ($input =~ m/\S+\s*$/gm); for my $match (@matches) { print "|$match|\n"; }'
|bbb |
|ddd |
|fff |

My test reusults with MULTILINE_MASK are:

\S+\s*$:

|fff |

\S+ *$:

|bbb |
|ddd |
|fff |

But with Perl5Matcher.setMultiline(true), they are:

\S+\s*$:

|bbb |
|ddd |
|fff |

\S+ *$:

|bbb |
|ddd |
|fff |

For now use setMultiline(true) if you can.  I can't say for sure if
this is a regression, a lurking bug, or an intended distinction between
compiling with MULTILINE_MASK and setMultiline(true).  (I doubt
it's an intended distinction).  I'll look at it over the weekend because
the source of the discrepancy is not immediately obvious to me.  If
you can, open a bugzilla report to track the problem.  After resolving
this I'd like to vote on a 2.0.8 maintenance release since we've got
another fix that's been sitting in CVS for a while.

daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.