I have a string, where I need to parse it as a float, but first I need to replace it, if it is not a number (an integer or a float), so I am trying to create an regular expression to do it
My tries results in NaN
One of my best tries is
var $replace = $text.replace(/^[^d.]*/, '');
var $float = parseFloat($replace);
Can anybody tell me, what I am doing wrong?
dor a.from the beginning of your string with nothing... What are you trying to replace/remove exactly?$textmight look like, and what you want$replaceand$floatto look like in those cases?