Your second pattern is pretty much all the way there. One thing: you forgot the string-end anchor:
/^\d+(\.\d)?$/
Now there can be no trailing periods.
Another thing: you should repeat the second \d+
as well, unless you want to limit yourself to one decimal place:
/^\d+(\.\d+)?$/
Finally, it's generally good practice to suppress capturing unless you explicitly need it:
/^\d+(?:\.\d+)?$/