Created
May 21, 2013 10:38
-
-
Save detj/5618900 to your computer and use it in GitHub Desktop.
Strip anything other than ASCII. Note: This also removes Chinese, Japanese and other Unicode characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var re = /(?![\x00-\x7F]|[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3})./g; | |
var str = "カナダ假借字A�युनिकोड"; | |
str.replace(re, ""); // "A" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment