Using the regexp /.?0+$/, why are the zeros in “500” not a match?

The code below is working perfectly: it should remove unnecessary trailing zeros at the end of the decimal part of a number.

`    let solution = math.evaluate(inputValue);
    
    input.value = solution.toFixed(8).replace(/.?0+$/, '');`

I’m trying to understand the regular expression better. If the operator “?” indicates that the dot (.) is optional, it may or may not appear, so why doesn’t this code strip the zeros from a string like “500”? It would be a bug, but I can’t understand why it doesn’t happen.

Ie: With the string “5.00”, the zeros will be removed, but with “500”, no. This seems to contradict that the presence of the dot is optional for a match to occur in the regexp.