Re: problem in parsing

From: Date: Fri, 09 Aug 2002 09:38:10 +0000
Subject: Re: problem in parsing
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-21075@lists.php.net to get a copy of this message
On Fri, 9 Aug 2002, J-E-N wrote: Hi! This one: $exp = "description=whatever\namount=23.50\nquantity=2\n"; if (preg_match("/amount=([0-9]{1,9}\.[0-9]{1,9})(\n)/", $exp,$amt)) { print $amt[1]; } will output "23.50" and this one: $exp = "description=whatever\namount=23.50\nquantity=2\n"; if (preg_match("/(amount=[0-9]{1,9}\.[0-9]{1,9})(\n)/", $exp,$amt)) { print $amt[1]; } will output "amount=23.50" Regards Urosh > if i have the following script, > > $exp = "description=whatever\namount=23.50\nquantity=2\n"; > if (eregi("(amount)(.*)(\n)", $exp,$amt)) { > print $amt[0]; > } > > the output will be > > namount=23.50\nquantity=2\n > > > what will i do so that the output value will be 23.50 only. > > > thanks =) > jen > > >

« previous php.db (#21075) next »