I want to do a string validation, the rule is the string only allowed to have the following characters:
- Letters
- Numbers
- Space or Whitespace
- Specific symbols : ( ) . - /
If the string contains a character that is not in the above list, it should return a false result
I tried to do it like this:
return value.match(/[().-\/]/) || value.match("^[A-Za-z0-9]+$") || (value.indexOf(' ') !== -1) ? true : false;
It works if you have only disallowed character, if I have allowed characters mixed in it will return true