Why is this regex finding slashes?
[^A-Za-z0-9(\\)@% \"]
I want this regex to find everything except all those characters in there? 开发者_如何学编程it works for most but it's finding slashes.
you need to escape the slash for it to be matched ("[^A-Za-z0-9(\\)@% \"]")
how is this defined in the code? as a string literal? If not you might not be escaping the escapes correctly. Try with an @ at the front, as the regex as is seems to work ok for me and not match the '\' character.
I think you are doing this
string pattern = "[^A-Za-z0-9(\\)@% \"]"
Try like so:
string pattern = @"[^A-Za-z0-9(\\)@% \"]"
you migth find this useful if that is the issue
Because the \
is a special character an needs to be escaped: \\
"[^A-Za-z0-9(\\\\)@% \"]"
精彩评论