I am trying to write up a regular expression that accepts numbers, decimals as well as an empty string / null value.
My current expression accepts decimal values that are dot separated. The numbers can start with either a - (minus) or + (plus). Additionally, the value can start with a decimal point - for instance: .56
Here is the expression:
/^([-+]?(\d+|\.\d+|\d+\.\d*))?$/
How can I refactor it to accept an empty string/ null value?