How can I use all the following characters as a regular expression in the javascript match method and escape the characters that need to be escaped?
~!@#$%^&*()_-+={}[]|:;<>,./? and space
so that mysstring.match(REGEX) returns null only if mysstring does not contain any of the above set of characters
"abc".match(REGEX) //should return null
"abc@".match(REGEX) //should NOT return null (it has @)
"ab c".match(REGEX) //should NOT return null (it has a space)
"++abc".match(REGEX) //should NOT return null (it has +)
Aucun commentaire :
Enregistrer un commentaire