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;
}
}

URL validation

Leave your comment

  • Mahesh Tryambake

    Good one, i like
    com|org|net|mil|edu|ca|co.uk|co.in|com.au|ac.in|gov|gov.in