First of all this question is not same as
strip non-numeric characters from string or
Regex to replace everything except numbers and a decimal point
I want to convert a string with valid number like.
--1234// will be -1234
-123-123 will be -123123
12.123.3 will be 12.1233
-123.13.123 will be -123.13123
I tried those
number.replace(/[^0-9.-]/g, '') //it accepts multiple . and -
number.replace(/[^0-9.]-/g, '').replace(/(\..*)\./g, '$1');//it accepts multiple minus
I am facing Problem with leading minus sign.
How I can convert a string which will remove all characters except leading -(remove other minus),digits and only one dot(remove other dots)