Python 使用正则表达式匹配URL网址

1  import re
2  str = "http://www.baidu.com/"
3  regular = re.compile(r'[a-zA-Z]+://[^s]*[.com|.cn]')
4  re.findall(regular, str)                             
 ['http://www.baidu.com']
原文地址:https://www.cnblogs.com/Yanss/p/12745802.html