Regex to Strip Special Characters
- by Neil
I am trying to use regex.replace to strip out unwanted characters, but I need to account for spaces:
string asdf = "doésn't work?";
string regie = @"([{}\(\)\^$&._%#!@=<>:;,~`'\’ \*\?\/\+\|\[\\\\]|\]|\-)";
Response.Write(Regex.Replace(asdf,regie,"").Replace(" ","-"));
returns doésntwork instead of doésnt-work
Ideas?
Thanks!