我需要一个正则表达式来检查输入是否包含以下字符
\/:*?:"<>|
输入可以允许除上述之外的所有键盘键。
答案 0 :(得分:1)
您可以在此处使用否定字符类[^ ]
。
^[^\\/*?:"<>|]*$
正则表达式:
^ # the beginning of the string
[^/*?:\"<>|]* # any character except: '\', '/', '*', '?', ':', '"', '<', '>', '|' (0 or more times)
$ # before an optional \n, and the end of the string