"""
re :regulation expression 正则表达式
re.findAll(pattern,待查找对象) 返回匹配的所有的列表
\d 返回所有数字(单个)
\d+ 返回连续的数字
\d* 返回0个或者多个数字
\w 返回非标点符号的数字
\D 返回非数字的
"""
import re
text = "name:maishu,height:178,weight:68,id:123456,password:9527"
print(re.findall(r"\d*", text))
import re
"""
组合模式匹配
"""
text = "name:maishu,height:178,weight:68,id:123456,password:9527,tel:051-86953489"
print(re.findall(r"\d{3,4}-\d{8}", text))
import re
"""
使用或来查找符合条件的结果
"""
text = "name:maishu,height:178,weight:68,id:123456,password:9527,tel:051-86953489,mobile:15905103896"
print(re.findall(r"\d{3,4}-\d{8}|\d{11}", text))