Test, validate and match regular expressions
This multiline regex matches numeric strings and splits them into named capture groups so useless zeroes can be removed during replacement. It captures an optional negative sign (negative), a leading zero (preceding), the core digits with an optional decimal point (main), and trailing zeroes with an optional dot (trailing). Ideal for normalizing decimals, e.g. turning '-0.500' into '-.5' or '1.20' into '1.2' by keeping only the negative and main groups.