[Tutor] error message

Jacob S. keridee at jayco.net
Mon Feb 14 03:16:49 CET 2005


Okay...
Cool.
Jacob


> group() defaults to returning group 0 which is the whole match.
> 
>  >>> import re
>  >>> string = 'My phone is 410-995-1155'
>  >>> pattern = r'\d{3}-\d{3}-\d{4}'
>  >>> re.search(pattern,string).group()
> '410-995-1155'
> 
> Kent
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
>


More information about the Tutor mailing list