- 帖子
- 10
- 精华
- 0
- 积分
- 75
- 阅读权限
- 20
- 注册时间
- 2018-4-27
- 最后登录
- 2018-7-26
|
loveting0jie 发表于 2018-6-22 11:25
[(]?0\d{2,3}[ )-]?\d{8}
\(?0\d{2,3}[) -]?\d{7,8}
\(0\d{2,3}\)\d{8}|0\d{2,3}[ -]?\d{8}
例如:
import re
f = open('J:\黄杰\学习文件\练习\正则表达式\员工信息登记表.txt')
data = f.read()
a = re.findall(r'\(0\d{2,3}\)\d{8}|0\d{2,3}[ -]?\d{8}',data)
print(a)
f.close()结果:
['098219781020', '010619920410', '092319841019', '011519850315', '010619860329', '082219900115', '050219900104', '005198703026', '011978021509', '092119840108', '081199508113', '062119970505', '(021)88776543', '050219940911', '010-55667890', '098419950322', '011519871217', '0571 66345673', '004199303160', '022219880115', '058319890712', '062519920228', '032419941023', '098119940110', '068219831108', '006198510077']
|
|