Pattern for javascript & PHP
/^((http|https):\/\/)?(www[.])?([a-zA-Z0-9]|-)+([.][a-zA-Z0-9(-|\/|=|?)?]+)+$/
Validation function in Javascript
function checkForValidURL(value) {
var urlregex = new RegExp("^((http|https):\/\/)?(www[.])?([a-zA-Z0-9]|-)+([.][a-zA-Z0-9(-|\/|=|?)?]+)+$");
if (urlregex.test(value)) {
return (true);
}
return (false);
}
0 comments:
Post a Comment