I have this pattern:
[0-9]*\\.?[0-9]
It matches numbers but it also matches 3.5.4 as:
How to f
You have to decide if you want to accept numbers without leading zeros (eg .123). If you don't then the regex is easy:
^-?[0-9]+(\.[0-9]+)?$
If you do then it's a little more complex:
^-?(?:[0-9]+|[0-9]*\.[0-9]+)$
Both presume that a decimal point must be followed by at least one digit. If you don't accept negative numbers then the leading -? is unnecessary.