[buug] Re: regex question
Jeremy Brand, B.S.
jeremy at nirvani.net
Wed Apr 30 15:02:58 PDT 2003
Thus spake Nick Moffitt:
> > ($id) = $_ =~ m"UserID=(.*)&";
>
> That's nice, but it does a lot of backtracking from
> the end to figure out which & is the terminating symbol.
> It's much more efficient to use some variant of "[^&]+"
> instead of ".*". The match then stops at the first & it
> sees instead of hoping for a later one in the string.
Lol. I agree with you, but after thinking about this,
what's a regex in efficiency compared to starting up PERL.
I would have to speculate (because I'm too lazy right now
to time() it) that it is relatively negligible.
(apologies, no referring Message-Ids - already deleted the
email and had to refer to the archives)
:)
Cheers,
Jeremy
--
"Prediction is very difficult, especially of the future."
Niels Bohr
http://www.nirvani.net
More information about the buug
mailing list