I am looking for a regex to pick up all the trailing 0s after decimal from any number along with the decimal

42 Views Asked by At

Looking to pick up all those 0s which doesn't add any value to a number:

  • 1.000 should give .000
  • 0.000 should give .000
  • 0.0080 should give me 0
  • however 10 should remain 10, only after the decimals I want

I tried couple of regex but they are not working correctly, please if anyone can support, would be really appreciated, thanks in advance.

Tried

(\.*?)(0+)$

but this is picking up 0s which are actually valuable like in 10 or 100 etc.

0

There are 0 best solutions below