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).
精彩评论