I need to format numbers so that thousands were not separated by anything and hundreds were separated with a dot. For example
1234.56
12.34
123
I wrote the following ReqExp
amountValue.replace(/^(\d+)[,.](\d{3})[.,](\d{2})$/,'$1' + '$2' +'.'+'$3').replace(/^(\d+),(\d{2})$/,'$1' +'.'+'$2');
If there a way to make it shorter?
Thank you!
I would just remove any non numeric character that’s not the decimal point: