Reputation: 29720
I have the following regex:
foo = Regex.Replace(foo, @"[^a-zA-Z0-9\s-]", " ");
Currently, this removes Unicode characters. What regex can I use remove all non-URL friendly characters (i.e. : , < etc.), but allow Unicode and accented characters?
Thanks, Mark
Upvotes: 0
Views: 2353
Reputation: 29720
Microsoft.Security.Application.AntiXss.GetSafeHtml()
solved my problem.
Upvotes: 0
Reputation: 12336
How about instead of using a negated class, you simply have a replacement list of the characters you dont want?
s/[:,<]*//g
Upvotes: 3