Using php (preg_match) to validate if a variable is float.
Been searching online but still have not found the one that i need. Pls advise.
my requirements:
VALID
(numbers and one dot only)
0.1 (anything starting with 0, must follow by a dot and then number)
1.1234567890 (max. 10 decimal places)
NOT VALID
blank/spaces
0
0.
0.0
00.0
0.0.0
01
integers
+0.1 (no plus signs)
-0.1 (no minus signs)
.1
01.1
1.
0.1e38 (no exponential)
Solutions:
/^(?=.*[1-9])(?!0\d)([0-9]{1,10})(\.[0-9]{1,10})$/