I have an input text and I want to allow only numbers(positive and negative) with only one special character for each "." and "-". For example you can have -12.30, but -12...20 or --12.40 it is not allowed.
Currently I have this:
value.replace(/[^\d|.-]/g, "");
which allows multiple "." and "-".