I have string as:-
String -----> Result I need
1.25 acres ---> 1.25
125 acres ----> 125
1,25 sqft ----> 125
12,5 foot ----> 125
I am currently using :- .match(/\d+(\.\d+)?/) but it is getting 1 for 1,25 and 12 for 12,5
Any suggestion?
You could also remove the first , you encounter and then use parseFloat. Something like this:
parseFloat(str.replace(",",""))