例如我有以下字符串:
thats a\n\ntest\nwith multiline \n\nthings...
我尝试使用以下代码,该代码无法正常工作,但仍未包含所有字符:
string text = "thats a\n\ntest\nwith multiline \n\nthings and so on";
var res = Regex.IsMatch(text, @"^([a-zA-Z0-9äöüÄÖÜß\-|()[\]/%'<>_?!=,*. ':;#+\\])+$");
Console.WriteLine(res);
当包含以下字符时,我希望正则表达式返回 true only
(不必包含所有字符,但至少包含以下字符之一且不包含其他字符)
:a-z
、A-Z
、0-9
和.äüöÄÖÜß
!#'-.:,; ^"§$%&/()=?\}][{³²°*+~'_<>|
这是我认为在消息中使用会很好的已知键盘字符列表。