What is the regular expression for a decimal with a precision of 2?
Valid examples:
123.12 2 56754 92929292929292.12 0.21 3.1
I use this one for up to two decimal places: (^(\+|\-)(0|([1-9][0-9]*))(\.[0-9]{1,2})?$)|(^(0{0,1}|([1-9][0-9]*))(\.[0-9]{1,2})?$) passes: .25 0.25 10.25 +0.25 doesn't pass: -.25 01.25 1. 1.256
(^(\+|\-)(0|([1-9][0-9]*))(\.[0-9]{1,2})?$)|(^(0{0,1}|([1-9][0-9]*))(\.[0-9]{1,2})?$)