I’m currently using a regex for detecting valid floating point numbers which looks like this:
/^[0-9]{1,10}(.d{0,3})?$/
I am able to match the following values as expect:
0
0.
0.1
0.12
0.123
I do however need to be able to validate and match the following inputs as these values can be parsed as a Number type in JavaScript.
.1
.12
.123
I’ve looked at optional first character matching but so far I haven’t been able to come up with a tangible solution. I think the fact that it’s optional makes it tricky to implement