[buug] regex question

Aaron T Porter atporter at primate.net
Wed Apr 30 14:37:51 PDT 2003


On Wed, Apr 30, 2003 at 01:56:24PM -0700, Nick Moffitt wrote:

> > 	($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.

	My perl code is rarely (if ever) described as efficient :)



More information about the buug mailing list