With the following regular expression will cause an infinite loop, analyze the specific reasons behind
import re
url = "http://search.www.gov.cn/search/fw/cateSearch.do?webid=1&category=bmfw&q="
if re.match('^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$', url):
print 'ok'
else:
print 'no'
Url for a regular grammar finished
url = "http://search.www.gov.cn/search/fw/cateSearch.do?webid=1&category=bmfw&q="
if re.match('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', url):
print 'ok'
else:
print 'no'