Skip to content

Instantly share code, notes, and snippets.

@ikegami-yukino
Created July 28, 2015 02:27
Show Gist options
  • Save ikegami-yukino/bee699d090eed7d5dade to your computer and use it in GitHub Desktop.
Save ikegami-yukino/bee699d090eed7d5dade to your computer and use it in GitHub Desktop.
Japanese character matcher for Java8
private static final Pattern PAT_JAPANESE_CHARACTER = Pattern
.compile("[\\p{IsHiragana}\\p{IsKatakana}\\p{InCJKUnifiedIdeographs}]");
private static boolean isJapanese(final String token) {
return PAT_JAPANESE_CHARACTER.matcher(token).find();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment