Regex for matching multilingual numbers not detecting Chinese numbers

I have a method that determines if a string is a number:

public static boolean isNumber(String num) { return num.matches("(\\p{N})+"); } 

The above method successfully matches English, Hindi, Arabic numerals, but does not match Chinese numbers:

三 十萬 零 二百 二百 etc.

Is it possible to create a regular expression that can match a number from any language (or main languages)?

edit: the number will not be decimal, it will be used to check the phone number.

+5
source share
1 answer

as noted in the comments, these are the words used for numbers, i.e. "one", "two", "three", etc. China introduced the Indo-Arabic numerals in the 19th century, so \p{N} must also match the Chinese numbers. If you also want literals, you should include them, as suggested by stribizhev.

0
source

All Articles