I want to check for special characters in a string EXCEPT spaces and delete them.
Ex: input = "Oh Boy!!#$" output = "Oh Boy"
Can someone help me with the regular expression to implement this in C#
I want to check for special characters in a string EXCEPT spaces and delete them.
Ex: input = "Oh Boy!!#$" output = "Oh Boy"
Can someone help me with the regular expression to implement this in C#
This is one way:
Console.WriteLine(Regex.Replace("Oh Boy!!#$", @"[^\w ]", ""));