Created
October 31, 2013 17:10
-
-
Save feanz/7253371 to your computer and use it in GitHub Desktop.
Remove Special Characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static string RemoveAllSpecialCharacters(string input) | |
{ | |
var r = new Regex("(?:[^a-z0-9 ]|(?<=['\"])s)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); | |
return r.Replace(input, String.Empty); | |
} | |
protected static string RemoveSelectSpecialCharacters(string input) | |
{ | |
var r = new Regex("[~#%&*{}:<>?|\".]", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); | |
return r.Replace(input, String.Empty); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment