How do I remove all non alphanumeric characters from a string except dash and space characters?
Replace [^a-zA-Z0-9 -] with an empty string.
[^a-zA-Z0-9 -]
Regex rgx = new Regex("[^a-zA-Z0-9 -]"); str = rgx.Replace(str, "");
2.1m questions
2.1m answers
60 comments
57.0k users