我的正则表达式在文本文件中找不到与我正在搜索的模式匹配的。这是我的密码:
myfile = ('_%s_Mail_%s.txt' % (timestr, emailid))
urls = re.search(r'^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$', myfile)
IPs = re.search(r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$', myfile)
print(urls.group())
print(IPs.group())
此项不返回任何值
这个表达有什么问题?你知道吗
您没有打开文件。您正在文件名上应用正则表达式。你知道吗
相关问题 更多 >
编程相关推荐