I'm looking for a regex in JavaScript that will select all non-digit characters except a single dot and a single dash. I tried [^0-9\.\-]+ but it doesn't select multiple dots or dashes. So it should select .. but not .
My use case is numeric input validation. A user can type any digit or single dot or single dash. And I will replace invalid inputs with an empty string.
-.-is valid input but--is not? - melpomene-.-should be also invalid. It adds complexity :) - AndreyparseFloat(input_data)and see if you getNaN- user9366559