Skip to content

Instantly share code, notes, and snippets.

@lackneets
Last active February 6, 2017 02:18
Show Gist options
  • Save lackneets/e9d0d5209831b0ec528a to your computer and use it in GitHub Desktop.
Save lackneets/e9d0d5209831b0ec528a to your computer and use it in GitHub Desktop.
Match Chinese and Japanese Characters
var regexCJ = /[\u4e00-\u9fa5]+|[\u0800-\u4e00]+/
!!'안녕하세요'.match(regexCJ) // false
!!'Hi There'.match(regexCJ) // false
!!'おはよう'.match(regexCJ) // true
!!'ㄤㄤ'.match(regexCJ) // true
!!'你好'.match(regexCJ) // true
!!'中国共产党万岁'.match(regexCJ) // true
// FIXME: complete the CJK! tell me the Koreanese pattern if you know
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment