Reputation: 4931
I am storing filename in my database and when a international language is used, it stores something like below as my filename.
å¹³ç´ ããèª ã«ãä¸è©±ã«ãªã£ã¦ããã¾ã.docx
please could someone give me a regular expression which will identify such invalid characters?
The below characters are acceptable :
a-z, 0-9 , () <> [] {} %^&*$#@~"';?:! etc.
are all acceptable. Just not the ones above which cannot be seen on the keyboard.
Thanks .
Upvotes: 0
Views: 1052
Reputation: 4317
A reasonably good approximation is
[^[:ascii:][:print:]]
which matches characters that are either non-ASCII or non-printable. The question stands open, of course, whether to be a printable ASCII code is enough for being acceptable as part of a file name...
Upvotes: 1