Javascript validation for URL
function imp_isUrl(url) {
return url.match(/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s\#%”\,\{\}\\|\\\^\[\]`]+)?$/);
}
to allow #,%,[,] in url use below regular expression
return s.match(/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s”\,\{\}\\|\\\^`]+)?$/);
No comments:
Post a Comment