I would like to validate my numbers in my form with decimal places.
a user could enter a value for the first one (concentration)
can be max of 10 numbers . 8 numbers
1,000,000,000.12345678
the second is 3 numbers . 2 numbers
ie 100.25
The problem is that it can have a decimal or it doesn’t have to for whole numbers i.e 100 and it is also requiring a 0 after. so 100.0.
This validates properly except for a whole numbers WITHOUT a decimal it is requiring a decimal due to how I set it up.
How could I validate it to have or not have a decimal?
array('concentration', 'match', 'pattern'=>'/^[0-9]{0,10}(\.[0-9]{0,8})/'),
array('temperature', 'match', 'pattern'=>'/^[0-9]{0,3}(\.[0-9]{0,2})/'),
Thanks for your help in advance!