Skip to content Skip to sidebar Skip to footer

Check If String Contains Cjk (chinese) Characters

I need to check if a string contains chinese characters. After searching i found that i have to look with the regex on this pattern \u31C0-\u31EF, But i don't manage to get the reg

Solution 1:

As discussed here, in Java 7 (i.e. regex compiler meets requirement RL1.2 Properties from UTS#18 Unicode Regular Expressions), you can use the following regex to match a Chinese (well, CJK) character:

\p{script=Han}

which can be appreviated to simply

\p{Han}

Post a Comment for "Check If String Contains Cjk (chinese) Characters"