RE: [PHP] Calling Regular Expression experts!

From: Date: Sun, 23 Jul 2000 23:08:11 +0000
Subject: RE: [PHP] Calling Regular Expression experts!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7792@lists.php.net to get a copy of this message
> I got a string like this $urldata = .."- SamsungYEPP1.995:- 2.500:- > DiamondRIO 5002.990:- - SonyMemorysti...3.990:- 4.000:- I ".. > What I want to do is to get the "1.995" value into a new > string. The problem > is that the 1.995, could look something like this : 1 995 > 1985 2.995 1,935 > . How Do I write a regular expresion for that? This seems to work quite nicely: preg_match_all('/([0-9]+[,. ]?[0-9]+)/', $urldata, $matches); for($i=0; $i<count($matches[0]); $i++){ echo $matches[0][$i]."<BR>\r\n"; } -- Richard Heyes http://www.heyes-computing.net/scripts/ Plain text email only please!

« previous php.general (#7792) next »