è possibile lavorare su questo?
codice:
Javascript regular expression to validate URL
console.log(learnRegExp('http://www.google-com.123')); // false
console.log(learnRegExp('https://www.google-com.com')); // true
console.log(learnRegExp('http://google-com.com')); // true
console.log(learnRegExp('http://google.com')); //true
console.log(learnRegExp('google.com')); //false
function learnRegExp(){
return /^(ftp|https?)://+(www.)?[a-z0-9-.]{3,}.[a-z]{3}$/.test(learnRegExp.arguments[0]);
}
console.log(learnRegExp('http://www.google-com.123.com')); // true
console.log(learnRegExp('http://www.google-com.123')); // false
console.log(learnRegExp('https://www.google-com.com')); // true
console.log(learnRegExp('http://google-com.com')); // true
console.log(learnRegExp('http://google.com')); //true
console.log(learnRegExp('google.com')); //false
function learnRegExp(){
return /((http|https)://(w+:{0,1}w*@)?(S+)|)(:[0-9]+)?(/|/([w#!:.?+=&%@!-/]))?/.test(learnRegExp.arguments[0]);
}
function learnRegExp(){
return /((ftp|https?)://)?(www.)?[a-z0-9-.]{3,}.[a-z]{3}$/.test(learnRegExp.arguments[0]);
}
/(http|https)://(w+:{0,1}w*@)?(S+)(:[0-9]+)?(/|/([w#!:.?+=&%@!-/]))?/