正则匹配身份证和邮箱

import re

str='sfafsf,34234234234,1231313132,37132719991123463x,sdefgr54184785ds85,' \
    '4864465asf86845,372526198911233456'

con = re.findall(r'[\d]{17}[0-9xX]' , str)
for i in con:
    print('身份证:', i)


y='123@qq.comaaa@163.combbb@126.comasdfasfs33333@adfcom'
ret=re.findall('\w+@[0-9a-zA-Z]+\.com',y)
print(ret)

  

 

posted @ 2018-05-29 13:50  汪凡  阅读(243)  评论(0编辑  收藏  举报