Reputation: 315
I need a regex to check if the input contain following characters
\/:*?:"<>|
The input can allow all the keyboard keys except the above mentioned.
Upvotes: 0
Views: 47
Reputation: 70750
You can use a negated character class [^ ]
here.
^[^\\/*?:"<>|]*$
Regular expression:
^ # the beginning of the string
[^/*?:\"<>|]* # any character except: '\', '/', '*', '?', ':', '"', '<', '>', '|' (0 or more times)
$ # before an optional \n, and the end of the string
Upvotes: 1