> As of Perl 5.6.2 (not released yet), /^(.*?):/ and 
> /^([^:]*):/ will have the same efficiency (read: speed).  If 
> you're curious, currently /^.*?:/ and /^[^:]*:/ have the same 
> speed -- it's the capturing that killed .*?, but I have fixed that.

Just to be clear, it's the capturing (.*?) of the string that suffers the
most (performance-wise), correct? What do you mean you have it fixed--that
future versions of Perl don't suffer a hit?

> And personally, I'd use /([^:]*)/ instead of /^([^:]*):/, 
> since they match the same thing (assuming there IS a colon in 
> the string).  Or I'd use /(.*?):/ instead of /^(.*?):/ but whatever.

What's the reason for preferring not to use the '^' ? Is it speed? Or just a
desire to make a regex a simple as possible?

Personally, I prefer making my regexs (and scripts, in general) as explicit
as possible, even if it means taking a performance hit.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to