Discuss / Python / 版本二可以验证并提取出带名字的Email地址:

版本二可以验证并提取出带名字的Email地址:

Topic source

林林1292

#1 Created at ... [Delete] [Delete and Lock User]

e = '<Tom Paris> tom@voyager.org' m = re.match(r'^(<\w+\s\w+>)\s+(\w+)@(\w+.\w+)$',e) if m!=None: print('Email is ok! The Email is :',m.group(0)) else: print('Email is failed! Please check it again. Your input is:\n',e)


  • 1

Reply