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

Tim Chase python.list at tim.thechases.com
Fri Sep 28 23:50:10 EDT 2012


On 09/28/12 22: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.

OP doesn't say it even has to be a string, so I guess



wins. :-P

It's-too-late-on-a-Friday-night'ly yers,

-tkc





More information about the Python-list mailing list