have have the regx variable.matches("\\.(....|..)")
. Now my String needs to have a dot, and two or four characters after the dot. But my problem is, that I need that the characters are only Numbers from 0-9. For example I need that its only match when I have for instance:
.12 or .22 or .8389 or.3920 and not .dd or .d93j, so the characters after the dot needs to be numbers, but variable.matches("[\\.(....|..)0-9]")
dont work, how we could fix that?
尝试这个:
"\\.(\d{2}|\d{4})"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.