开发者

.Net Regex that Matches Strings With Any non-ASCII char in it

Looking for some black magic that will match any string with "weird" characters in it. Standard ASCII characters are fine. Everything else isn't.

This is for sanitizing 开发者_运维知识库various web forms.


This gets anything out of the ASCII range

[^\x00-\x7F]

There are still some "weird" characters like x00 (NULL), but they are valid ASCII.
For reference, see the ASCII table


[^\p{IsBasicLatin}] for what is asked for, [^\x00-\x7F] for concision over self-documentation, or \p{C} for clearing out formatters and controls without hurting other non-ASCIIs (and with greater concision yet).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜