feanz
10/31/2013 - 5:10 PM

Remove Special Characters

Remove Special 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);
		}