Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Regular Expression In Python For E-Mail And Phone Number

DZone's Guide to

Regular Expression In Python For E-Mail And Phone Number

· ·
Free Resource
// 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
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}