at the end of your regex, replace .\d+$
by (?:\.\d+)?$
The dot .
means any character and therefore needs to be escaped : \.
(?:
start of non capturing group\.
literally a dot\d+
followed by at least 1 digit)?
end of the capturing group, that should appears 0 or 1 time (with?
)
CLICK HERE to find out more related problems solutions.