regexp non-greedy matching bug?

Aahz aahz at pythoncraft.com
Sun Dec 4 10:26:00 EST 2005


In article <mailman.1557.1133695862.18701.python-list at python.org>,
Fredrik Lundh <fredrik at pythonware.com> wrote:
>
>that's backwards, isn't it?  using ^ with match is usually pointless (since
>match only looks at the first position anyway), and using ^ with search
>is also usually pointless...

While you're technically correct, I've been bitten too many times by
forgetting whether to use match() or search().  I've fixed that problem
by choosing to always use search() and combine with ^ as appropriate.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Don't listen to schmucks on USENET when making legal decisions.  Hire
yourself a competent schmuck."  --USENET schmuck (aka Robert Kern)



More information about the Python-list mailing list