Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30456
| Date | 2012-09-28 21:17 -0500 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. |
| References | <de40c5ae-e51f-4b21-9355-da06a4882c89@googlegroups.com> <5066506D.4020702@tim.thechases.com> <k45kg5$qpo$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1599.1348884961.27098.python-list@python.org> (permalink) |
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"
)
(okay, so I also have one that solves the OP's underqualified
problem, but without the OP at least *trying* to code up an answer
and asking for help with it, I've give the snarky solution :-)
> How much memory does it use?
Insignificant.
> Shouldn't you be using the regex module from pypi instead of the
> standard library re?
Only if the OP requested it ;-)
> Guess who's borrowed the time machine?
Neutrino!
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. iMath <redstone-cold@163.com> - 2012-09-28 17:31 -0700
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Tim Chase <python.list@tim.thechases.com> - 2012-09-28 20:35 -0500
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Paul Rubin <no.email@nospam.invalid> - 2012-09-28 18:42 -0700
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-29 02:58 +0100
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Tim Chase <python.list@tim.thechases.com> - 2012-09-28 21:17 -0500
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-28 21:25 -0600
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-29 03:30 +0000
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Tim Chase <python.list@tim.thechases.com> - 2012-09-28 22:50 -0500
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-29 10:38 +0100
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Chris Angelico <rosuav@gmail.com> - 2012-09-29 20:05 +1000
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-29 11:50 +0100
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-29 11:04 -0600
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Chris Angelico <rosuav@gmail.com> - 2012-09-30 09:26 +1000
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Tim Chase <python.list@tim.thechases.com> - 2012-09-28 22:42 -0500
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-09-29 00:25 -0400
Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Fg Nu <fgnu32@yahoo.com> - 2012-09-28 21:25 -0700
csiph-web