var myURL;
function validURL(myURL) {
var pattern = new RegExp('^(https?://)?'+ // protocol
'((([a-zd]([a-zd-]*[a-zd])*).?)+[a-z]{2,}|'+ // domain name
'((d{1,3}.){3}d{1,3}))'+ // ip (v4) address
'(:d+)?(/[-a-zd%_.~+]*)*'+ //port
'(?[;&a-zd%_.~+=-]*)?'+ // query string
'(#[-a-zd_]*)?$','i');
return pattern.test(myURL);
}
document.write(validURL("http://qries.com"));