I know this has been asked many times and I did find a solution, value.replace(/^([\d,]+)$|^([\d,]+)\.0*$|^([\d,]+\.[0-9]*?)0*$/, "$1$2$3").
But... I'm no regex expert so I'm just curious as to why this doesn't work /[\.0]+$/... 10 should return 10 but I just can't figure out how to exclude whole numbers that end with 0s.
1.7500, 1.1010, 1.0000, 10
1.75, 1.101, 1, 1
/[\.0]+$/does not require the input to have a decimal point. You need to require it.?that the decimal was required?[\.0]leaves the choice to match with either.or with0. So if every time (of the repeated+) it is an0, it will still match -- without ever having matched a dot.(?<=\.)but can't do anything with the group, like test if it ends with 0s. Am I on the right track?