开发者

Regular expression to check for special characters except space

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 w开发者_如何学Pythonith the regular expression to implement this in C#


This is one way:

Console.WriteLine(Regex.Replace("Oh Boy!!#$", @"[^\w ]", ""));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜