RE: HELP!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: çæä [mailto:wangchq@xxxxxxxxxxxxxxxxx]
> Sent: Wednesday, March 30, 2005 11:46 AM
> To: php-general@xxxxxxxxxxxxx
> Cc: php-general@xxxxxxxxxxxxx

Why to AND cc?

> Would somebone give me a example of regulation expression to check
> account(or money) type which start with â$â.

> For example, â$65,786.00â

Same question was asked yesterday? 

$str = "$65,786.00";

if(ereg("^([\$]([0-9]+,)?[0-9]+\.[0-9]+)",$str, $pricetag))
  print "we found a price tag: $pricetag[1]";
else
  print "no prices found";

This is untested, the ([0-9]+,)? Means that there _may_ be digits and then a komma, but itÂs not necessary, threfore $786.00 and $1.00 matches too. The () around all expressions means, that we save whatever is matched into $pricetag

-- 
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen 
Systemudvikler/systemdeveloper


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux