decimal seperator is a dot, followed by max one digit! No range specified.
Thanks guys!
decimal seperator is a dot, followed by max one digit! No range specified.
Thanks guys!
^-?\d+(\.\d)?$
if the decimal part is optional, and
^-?\d+\.\d$
if it's required :)
Unlikely to be relevant in this case, but don't forget that "." is not universal as the decimal separator. Many European countries use "," so you might prefer to get the one in use from the locale:
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
String separator = df.getDecimalFormatSymbols().getDecimalSeparator();
(See also: http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormatSymbols.html#getDecimalSeparator)