It's also preferred if you use \d{2} instead of repeating \d
Mohammad Tayseer
http://spellcoder.com/blogs/tayseer
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how.
http://
On Tue, 20 Nov 2007 21:57:43 -0500, "J. Clifford Dyer"
<[EMAIL PROTECTED]> wrote:
>Use raw strings for re expressions.
Thanks guys for the prompt reply :-) Solved it.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 2007-11-21 at 03:24 +0100, Gilles Ganault wrote:
> Hello
>
> I've been reading tutorials on regexes in Python, but I still
> don't get it:
>
>
> #!/usr/bin/python
>
> #myscript.py 0123456789
>
> import sys,re
>
> #Turn 0123456789 into 01.23.45.67.89
> p = re.compile('(\d
> I've been reading tutorials on regexes in Python, but I still
> don't get it:
>
>
> #!/usr/bin/python
>
> #myscript.py 0123456789
>
> import sys,re
>
> #Turn 0123456789 into 01.23.45.67.89
> p = re.compile('(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)')
> phone = p.sub('\1.\2.\3.\4.\5',sys.a
Hello
I've been reading tutorials on regexes in Python, but I still
don't get it:
#!/usr/bin/python
#myscript.py 0123456789
import sys,re
#Turn 0123456789 into 01.23.45.67.89
p = re.compile('(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)')
phone = p.sub('\1.\2.\3.\4.\5',sys.argv[1])
print pho