I have a string, and I need to extract decimal number upto two precision using Regex function in Javascript.
or example, if I have string "RequestedAmount-12.20", I need to get the output as 12.20 and not 12.2. The regex I am using, gives me 12.2.
Here is the Regex I used.
str="RequestedAmout-12.20"
requestedamt = Number( str.replace( /[^0-9\.]+/g, "" ) );
I should get 12.20