----- 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, 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. > > r = re.compile("") doh! «smacks forehead» Yours is FAR more efficient, and much more readable than mine. iMath's teacher will be pleased :-) -tkc lulz. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
- write a regex matches 800-555-1212, 555-1212, and also (8... iMath
- Re: write a regex matches 800-555-1212, 555-1212, an... Tim Chase
- Re: write a regex matches 800-555-1212, 555-1212... Mark Lawrence
- Re: write a regex matches 800-555-1212, 555-... Tim Chase
- Re: write a regex matches 800-555-1212, ... Ian Kelly
- Re: write a regex matches 800-555-1... Tim Chase
- Re: write a regex matches 800-5... Fg Nu
- Re: write a regex matches 800-555-1212, ... Steven D'Aprano
- Re: write a regex matches 800-555-1... Tim Chase
- Re: write a regex matches 800-555-1... Mark Lawrence
- Re: write a regex matches 800-5... Chris Angelico
- Re: write a regex matches 8... Mark Lawrence
- Re: write a regex matches 8... Tim Delaney
- Re: write a regex matches 8... Chris Angelico
- Re: write a regex matches 8... Tim Delaney
- Re: write a regex matches 800-5... Ian Kelly
- Re: write a regex matches 800-555-1212, 555-... Devin Jeanpierre