I want to validate URL field something like below -
- http://www.example.com
- http://example.com
- www.example.com
First two are validation using below regex -
function is_valid_url(url) {
return /^http(s)?:\/\/(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(url);
}
but, when i am putting scenario 3 in textbox it showing me invalid URL.
Any help will be highly appreciated.
Thanks in Advance
Amod