Skip to content

Instantly share code, notes, and snippets.

@aar0nTw
Created May 21, 2014 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aar0nTw/90626ffdd245df7c3cb3 to your computer and use it in GitHub Desktop.
Save aar0nTw/90626ffdd245df7c3cb3 to your computer and use it in GitHub Desktop.
Check the string have cjk char
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