All,
I am looking for a JavaScript function that checks for the following characters (without commas) in a string. If they are present, it would return false, else returns true
<,>,(,),#,"",',:,::
Thanks
All,
I am looking for a JavaScript function that checks for the following characters (without commas) in a string. If they are present, it would return false, else returns true
<,>,(,),#,"",',:,::
Thanks
function (str) {
return ! (/[<>()#':]|""/.test(str));
}
any set of single characters can put put inside a [set of brackets]. For longer patterns, use the pipe.
edit: as patrick pointed out, if you're checking for : you don't need to check for :: separately.