NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
It is specified… (Score:1)
although you have to really search for it.
String("foo").matches("bar")says that it's equivalent toPattern.matches("bar","foo"), which is equivalent toPattern.compile("bar").matcher("foo").matches(); thePattern.matchermethod returns aMatcherobject, whose documentation says «Thematchesmethod attempts to match the entire input sequence against the pattern» and «Thefindmethod scans the input sequence looking for the next subsequence that matches the patternÂAgreed (Score:1)
As dakkar said, it IS documemented, but just barely. This same problem has bitten me about once every 2 months for the last two years (since switching to Java 1.5). You'd think I'd learn...
If only they made matchesAll() and matchesAny() instead of matches().
Re: (Score:1)
This same problem has bitten me about once every 2 months for the last two years (since switching to Java 1.5).
I remember this biting me a few years ago when I was doing text parsing and tagging, before Java 1.5. The project I was working on constantly reminded me of this difference from Perl because I actually had to translate the "prototype" code from C-styled Perl to Java for performance reasons (it was never benchmarked, actually). Sigh.