I was testing this in prompt mode:
import re
def checkurl(url):
check = re.match(r'^(:?https?://)?[^\/#?&]+\.[^\/#?&]+.*$',url)
if check == None:
print “NNOOOOOO!!!!”
else:
print “YESSSS!!!!!”
checkurl("javascript:void(0);")
checkurl("/account/general?ru=https%3a%2f%2fwww.bing.com%3a443%2fsearch%3fq%3dukraine%2bcrisis&FORM=SEFD")
checkurl("/?FORM=Z9FD1")
checkurl("http://choice.microsoft.com")
I have no idea why this won't work. Ignore the regex its only supposed to weed out relative paths and fragments of strings. I can't get the function to work at all.