Page 1 of 1

ereg to validate decimal

Posted: Mon Nov 22, 2004 2:49 pm
by dardsemail
Hi,

I am trying to write a little validation to ensure that numbers are entered to two decimal places.

Here's what I have - but it doesn't seem to be working:

Code: Select all

$validBidExpr = "^(ї0-9]{2,3,4,5,6,7,8,9}ї.]?)?ї0-9]{2}$"
I'm new to ereg, so I think I'm getting something wrong with the decimal.

Thanks!

Posted: Mon Nov 22, 2004 2:55 pm
by rehfeld
try this

$pattern = '^[0-9]+\.[0-9]{2,}$';


1 or more numbers followed by a period
then 2 or more numbers

im kinda new myself so maybe someone can confirm my pattern