Reputation: 26117
All,
I have following function to check for invalid symbols entered in a text box and return true or false. How can I modify this function to also check for occurrences like http:// and https:// and ftp:// return false if encountered ?
function checkURL(textboxval) {
return ! (/[<>()#'"]|""/.test(textboxval));
}
Thanks
Upvotes: 1
Views: 53
Reputation: 3102
function checkURL(textboxval) {
return ! (/[<>()#'"]|""|(https?|ftp)\:\/\//.test(textboxval));
}
Upvotes: 2