Your requirement is not clear enough.
Assuming your number need to fulfill the following, use a regex to check for valid entry:
1) the number starts with at least one digit
2) the number has exactly one decimal separator (the dot)
3) the number has exactly one or two fractional digits
4) the number may be surrounded by spaces
^\s*\d+\.\d\d?\s*$
Cheers
Andi