[Mpls-pm] Interesting RegEx Problem
Andy Lester
andy at petdance.com
Mon Sep 19 14:01:44 PDT 2005
On Mon, Sep 19, 2005 at 09:56:53PM +0100, Ian Malpass (ian at indecorous.com) wrote:
> Oh yes, I'd forgotten about study(). Note that the documentaton is
> equivocal about the performance benefits of study()[0], since there is
> overhead in studying a string, and no guarantee of it giving you anything
> in return.
As I understand it, study says "I'm going to find the first instance of each of
the 256 possible characters in the string, so that strings anchored with
a literal can start right there."
This means, if you have
$str = "Minneapolis Perl Mongers";
then
$str =~ /Perl/
can start right at position 12 rather than scanning to find it, and
$str =~ /fried cheese/
doesn't have to match anything because there's no "f" in $str,
$str =~ /.+flooble/
doesn't do anything differently.
xox,o
Andy
--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
More information about the Mpls-pm
mailing list