regex replace all special characters 1

regex replace all special characters

Regex.Replace(your String, @"[^0-9a-zA-Z]+", "") 

Here is what the above code is Doing:
1. The @ symbol tells the compiler that the string is a verbatim string literal.
2. The [^0-9a-zA-Z]+ is a regular expression that matches any character that is not a digit, lowercase letter, or uppercase letter.
3. The ” ” is the replacement string.

Similar Posts