What is Java Regex to match number then space then 3 alphabet char? -
i want validate of money currency unit.
100 usd : valid 1.11 usd : not valid 1,12 usd : not valid 12 : not valid
so valid string "the number space 3 alphabet char".
text.matches("^\\d+ [a-za-z]{3}*$")
i got error: exception caught: dangling meta character '*' near index 16 ^\d+ [a-za-z]{3}*$
so how fix it?
i fixed obmitting * fine:
text.matches("^\\d+ [a-za-z]{3}$")
Comments
Post a Comment