I'm working on google maps, which is retuning distance in string like 1,230.6 km
. From this I wanted to extract the floating number 1230.6
.
Below is what I tried
var t = '1,234.04 km';
var a = t.replace(/[^0-9]/g, '') // 123404
parseFloat(t) // 1
How do I fix this with Regex ? Please guide