Hi friends. I am making URL validation with Javascript. The format I need for the URL is http://example.com without considering www in the URL. Please help me. Thanks in adavance.
try this one function checkURL(value) { var myregex = new RegExp("^(http:\/\/|https:\/\/|ftp:\/\/){1}([0-9A-Za-z]+\.)"); if(myregex.test(value)) { return(true); } else { return(false); } Code (markup):
thnaks for the help..... i have tried like this... function checkURL() { var url = document.frm1.url.value; var myregex =new RegExp("^(http:\/\/){1}([0-9A-Za-z]+\.)"); if(myregex.test(url)) { document.write(url); return true; } else { alert("Error"); return false; } } but it is considering www in the validation and i need url without www. So how to ignore www using this? plz help me... Thanks again.....