write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Sep 29 05:38:17 EDT 2012


On 29/09/2012 04:30, Steven D'Aprano wrote:
> On Fri, 28 Sep 2012 21:25:35 -0600, Ian Kelly wrote:
>
>> Mine is simpler and faster.
>>
>> r = re.compile("")
>
> The OP doesn't say that you have to compile it, so just:
>
> ''
>
> wins.
>
>
>

My understanding is that Python 3.3 has regressed the performance of ''. 
  Surely the Python devs can speed the performance back up and, just for 
us, use less memory at the same time?

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list