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
^[0-9]+(\.([0-9]{1,2})?)?$
Will make things like 12. accepted. This is not what is commonly accepted but if in case you need to be “flexible”, that is one way to go. And of course [0-9] can be replaced with \d, but I guess it’s more readable this way.
12.
[0-9]
\d