r "[+ -]? \ d *.? \ d +"
This regex is accepting numbers with more than one point Ex: 12.23.43 and was not to accept ...
Try this:
r"^([+-]?\d+)(\.\d+)?$"