Find a regular that is greater than or equal to 0 and retains at most two decimal places.

can be an integer greater than or equal to 0 or a decimal that is greater than or equal to 0 and retains up to two places

0 true
0.1 true
1 true
1.22 true
1.222 false
01 false
00 false
Mar.30,2021

/ ^ (0 | [1-9]\ d *) (\ s | $|\.\ d {1pm 2}\ b) /


^(?:[1-9]\d*|0)(?:\.\d{1,2})?$
Menu