DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Simple living is my funda. Vinil has posted 1 posts at DZone. You can read more from them at their website. View Full User Profile

Regular Expression In Python For E-Mail And Phone Number

03.25.2012
| 6967 views |
  • submit to reddit
        // code contains regular expression for contact number and email address in python

str='abc@example.com'
match=re.search(r'\w+@\w+',str) #return abc@example.com
num=555-555-555
match_num=re.search(r'^(\d{3}--\d{3}--\d{4})$',num) #return 555-555-5555