write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.
Ian Kelly
ian.g.kelly at gmail.com
Fri Sep 28 23:25:35 EDT 2012
On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase
<python.list at tim.thechases.com> wrote:
> On 09/28/12 20:58, Mark Lawrence wrote:
>> On 29/09/2012 02:35, Tim Chase wrote:
>>> On 09/28/12 19:31, iMath wrote:
>>>> write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.
>>>
>>> Okay, that was pretty easy. Thanks for the challenge :-)
>>
>> What's the run time speed like?
>
> O(1)
>
> r = re.compile(
> "800-555-1212|"
> "555-1212|"
> r"\(800\) 555-1212"
> )
Mine is simpler and faster.
r = re.compile("")
More information about the Python-list
mailing list