|
Posted by Rik on 05/08/06 11:12
jenngra@gmail.com wrote:
> I need an expression which will only pass/clear currency data, 0.00
> thru 9999999.00. How would that be parsed? Thanks so much!
Regular Expression?
Sure 9999999,99 isn't allowed? Saves some code.
'/(0\.[0-9]{2}|[1-9][0-9]{0,5}\.[0-9]{2}|[1-9][0-9]{6}[0-8]\.[0-9]{2}|999999
9\.00)/'
But why not:
$max = 9999999.00;
$min = 0.00;
$pass = (isfloat($data) && number_format($number, 2, '.', '')==$data &&
$data >= 0 && $data<=9999999);
Makes it a bit more versatile.
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|