Reputation: 255
I want to check by using Regular-Expression
whether my String contains any Marathi letter.
Upvotes: 1
Views: 1208
Reputation: 56819
Use \p{BlockName}
to match characters in the specified Unicode block. To obtain block name for your language, check out: Character.UnicodeBlock
Probably \p{InDevaganari}
is what you need.
You can check character type by looping through a sample text and use Character.UnicodeBlock.of(int codePoint)
to see the code block of the character.
Note that you have to compile your file with -encoding utf8
option (e.g. javac -encoding utf8 Main.java
). And you have to set all the input stream to use UTF8 encoding.
Upvotes: 1