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

2012-09-29 Thread Mark Lawrence
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 ''.

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

2012-09-29 Thread Chris Angelico
On Sat, Sep 29, 2012 at 7:38 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: 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? Yes, but to do that we'd have to

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

2012-09-29 Thread Mark Lawrence
On 29/09/2012 11:05, Chris Angelico wrote: On Sat, Sep 29, 2012 at 7:38 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: 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

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

2012-09-29 Thread Ian Kelly
On Sat, Sep 29, 2012 at 3:38 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: 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? At least it will be stored as a

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

2012-09-29 Thread Tim Delaney
On 29 September 2012 20:05, Chris Angelico ros...@gmail.com wrote: On Sat, Sep 29, 2012 at 7:38 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: 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

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

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 6:51 AM, Tim Delaney timothy.c.dela...@gmail.com wrote: Personally I voted for the Fierce Snake[1][2] as the delimiter, but it was voted down as not Pythonic enough. I'm sure they were using that as a euphamism for Python*ish* though. [1]

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

2012-09-29 Thread Tim Delaney
On 30 September 2012 09:26, Chris Angelico ros...@gmail.com wrote: On Sun, Sep 30, 2012 at 6:51 AM, Tim Delaney timothy.c.dela...@gmail.com wrote: Personally I voted for the Fierce Snake[1][2] as the delimiter, but it was voted down as not Pythonic enough. I'm sure they were using that

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

2012-09-28 Thread iMath
write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. -- http://mail.python.org/mailman/listinfo/python-list

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

2012-09-28 Thread Tim Chase
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 :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list

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

2012-09-28 Thread Paul Rubin
iMath redstone-c...@163.com writes: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. And then you have two problems. -- http://mail.python.org/mailman/listinfo/python-list

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

2012-09-28 Thread Mark Lawrence
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 :-) -tkc What's the run time speed like? How much memory does it use? Shouldn't you

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

2012-09-28 Thread Tim Chase
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: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase python.l...@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

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

2012-09-28 Thread Steven D'Aprano
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 -- http://mail.python.org/mailman/listinfo/python-list

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

2012-09-28 Thread Tim Chase
On 09/28/12 22:25, Ian Kelly wrote: On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase On 09/28/12 19:31, iMath wrote: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. r = re.compile( 800-555-1212| 555-1212| r\(800\) 555-1212 ) Mine is simpler and faster

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

2012-09-28 Thread Tim Chase
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

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

2012-09-28 Thread Devin Jeanpierre
On Fri, Sep 28, 2012 at 9:58 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: What's the run time speed like? How much memory does it use? Shouldn't you be using the regex module from pypi instead of the standard library re? Guess who's borrowed the time machine? O(n), O(1), and I used RE2.

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

2012-09-28 Thread Fg Nu
- Original Message - From: Tim Chase python.l...@tim.thechases.com To: Ian Kelly ian.g.ke...@gmail.com Cc: Python python-list@python.org Sent: Saturday, September 29, 2012 9:12 AM Subject: Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. On 09/28/12 22:25