import re #常见实例 #1.匹配.com或.cn后缀的url网址 #[^\s]代表匹配非空字符 # parrent="[a-zA-Z]+://[^\s]*[.com|.cn]" # string="<a href='http://www.baidu.com'>百度首页</a>" # string1="www.baidu54.cn" # result=re.search(parrent,string) # result1=re.search(parrent,string1) # print(result) # print(result1) #匹配手机号码 parrent
正则匹配手机号和网址
最新推荐文章于 2023-07-09 15:31:53 发布