-
-
Regex Expression to Replace Special Characters with UnderScore
by azamsharp on 5/22/2008 6:14:41 PM
-
When writing friendly URLS I had this requirement to replace the special characters with underscore. Here is a simple regex expression.
-
using System.Text.RegularExpressions;
string sd = TextBox1.Text;
sd= Regex.Replace(sd.Trim(), "\\W", "_", RegexOptions.IgnoreCase | RegexOptions.Multiline);
-
Refactor it!
Please log in to refactor the code!
Login