Reputation: 3652
I want to validate the about of money with the currency Unit.
100 USD : valid 1.11 USD : not valid 1,12 USD : not valid 12 US : not valid
So the valid string is "the number then space then 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 to fix it?
Upvotes: 0
Views: 80
Reputation: 3652
i fixed obmitting * then it is fine:
text.matches("^\\d+ [a-zA-Z]{3}$")
Upvotes: 1