In my VF page I have some Javascript to format passed variables. I have a string eg "Cost is $100.00" from which I need to remove all non-digit characters, EXCEPT the digital period. I want the result to be 100.00
I currently have:
var x = "Cost is $100.00";
var y = x.replace(/\D/g, '');
which removes all non-digit characters, including the "." What do I need to do to keep that?