Discuss / Python / job

冰月冷望

#1 Created at ... [Delete] [Delete and Lock User]
re_mail1=re.compile(r'[\w\d\.]+@\w+\.\w{2,}')
re_mail2=re.compile(r'<([A-Z][a-z]*)\s+(\w+)>\s[\w\d\.]+@\w+\.\w{2,}')
print(re_mail1.match('bill.gates@microsoft.com'))
print(re_mail2.match('<Tom Paris> tom@voyager.org').group(1))

  • 1

Reply