Originally posted by bubblenut
Regular expressions. [man]PCRE[/man]
if(preg_match('/^[1-9][0-9,]*\.[0-9]{0,2}$/', $string)) {
echo('OK');
} else {
echo('BAD');
}
HTH
Bubble [/B]
0,,,,,,,,,.00 will be passed as good string
1.1 will be passed as good string
I think for price better is:
/[0-9]{1,3}(?:,[0-9]{3})*.(?:[0-9]{2})?$/