Created
May 21, 2014 08:53
-
-
Save aar0nTw/90626ffdd245df7c3cb3 to your computer and use it in GitHub Desktop.
Check the string have cjk char
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
define (require) -> | |
## | |
# Unicode range for CJK words. | |
# 3000 - 303f: Japanese-style punctuation | |
# 3040 - 309f: Hiragana | |
# 30a0 - 30ff: Katakana | |
# ff00 - ff9f: Full-width Roman characters and half-width Katakana | |
# 4e00 - 9faf: CJK unified ideographs - Common and uncommon Kanji | |
# 3400 - 4dbf: CJK unified ideographs Extension A - Rare Kanji | |
## | |
CJK_RE = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/ | |
CJKMatcher = | |
match: (string) -> !!string.match(CJK_RE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment