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
More information about the Python-list mailing list
Fri Sep 28 23:30:17 EDT 2012
- Previous message (by thread): write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.
- Next message (by thread): write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.
- Next message (by thread): write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list