I want to validate URLs of the following form:
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);
}
1 and 2 are validated correctly. But 3 shows an invalid URL.