Floating point regular expression between 0 and 1

I am trying to verify the input of floating-point numbers, where the maximum value is 1.0 and the minimum value is 0.

Min: 0
Max: 1

Possible value;

0.1
0.99
0.365

How can I succeed with regular expressions?

as javascript regular expression text:

/^(0(\.\d+)?|1(\.0+)?)$/

I am trying to verify the input of floating point numbers , Where the maximum value is 1.0 and the minimum value is 0.

Min: 0
Max: 1

Possible values;

0.1
0.99
0.365

How can I succeed with regular expressions?

As javascript regular expression text:

/^(0(\.\ d+)?|1(\.0+)?)$/

Leave a Comment

Your email address will not be published.