Build, test, and debug regular expressions
This regex identifies characters that need to be removed to format a string as a valid decimal number. It matches any character that is not a digit, period, or hyphen. Additionally, it targets hyphens that are not at the beginning of the string, and any period that is followed by another period, ensuring only one decimal point remains. This is useful for sanitizing and extracting numeric values from messy user input.