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

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Sep 28 23:30:17 EDT 2012


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.



-- 
Steven






More information about the Python-list mailing list