The problem here is the two 0 or more [0-9] elements on each side of the decimal point. we need to use a logical OR | in the number identification line: E.g 0.00434, 0.233220, 4.909, 0.0000003333 Solution amount ~ '^([0-9]+\.?[0-9]*|\.[0-9]+)$'