function checkURL(url)
{
var theurl=url;
var tomatch= /^(http[s]?:\/\/|ftp:\/\/)(www\.)?[a-zA-Z0-9-\.]+\.(com|org|net|mil|edu|ca|co.uk|co.in|com.au|ac.in|gov|gov.in)(\/[A-Za-z0-9\.-])?/;
if (tomatch.test(theurl))
{

return true;
}
else
{

return false;
}
}

By

One thought on “URL validation”
  1. Good one, i like
    com|org|net|mil|edu|ca|co.uk|co.in|com.au|ac.in|gov|gov.in

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.