i have a code which loops through list of urls to do some operations but the entered urls must each contain query string , i want to check first if the url is correct and in fact contains query strings , i searched and most of the regular expressions i found only check for the url , the closest solution i found is using urlparse like this
#!/usr/local/bin/python2.7
from urlparse import urlparse
line = "http://www.compileonlinecom/execute_python_online.php?q="
o = urlparse(line)
print o
# ParseResult(scheme='http', netloc='www.compileonlinecom', path='/execute_python_online.php', params='', query='q=', fragment='')
if (o.scheme=='http' and o.query!=''):
print "yes , that is a url with query string "
else:
print "No match!!"
but i wonder if it could be done with a more solid regex