Re: Bug #4085: preg_match_all/RegEx
| From: | Faisal Nasim | Date: | Sun, 09 Apr 2000 05:48:32 +0000 |
| Subject: | Re: Bug #4085: preg_match_all/RegEx | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17759@lists.php.net to get a copy of this message | ||
<?
$string = ' FORSALE / WIDGET 289031955 $9.00 $15.50 - 1 3 Mar-20-00
Mar-27-00 19:12:49 Ended blah ';
$regex = "/ *(FORSALE .+ Ended) */";
preg_match_all($regex,$string,$matches,PREG_SET_ORDER);
print $matches [0][1];
?>
Output on PHP 4.0-RC1:
FORSALE / WIDGET 289031955 $9.00 $15.50 - 1 3 Mar-20-00 Mar-27-00 19:12:49
Ended
Looks fine to me!
Enjoy!
Faisal
P.S. If there are many patterns you should use a "?" after .+ as well.
$regex = "/ *(FORSALE .+? Ended) */";
----- Original Message -----
From: <ralph@ceenet.com>
To: <php-dev@lists.php.net>
Sent: Sunday, April 09, 2000 10:29 AM
Subject: [PHP-DEV] Bug #4085: preg_match_all/RegEx
: From: ralph@ceenet.com
: Operating system: Linux Slackware 7
: PHP version: 3.0.16
: PHP Bug Type: Other
: Bug description: preg_match_all/RegEx
:
: There appears to be a problem in the regex function preg_match_all:
:
: Here is the exact string that should be plucked from a blob of text:
:
: FORSALE / WIDGET 289031955 $9.00 $15.50 - 1 3 Mar-20-00 Mar-27-00 19:12:49
Ended
:
: $regex = "/ *(FORSALE .+ Ended) */";
: preg_match_all($regex,$string,$matches,PREG_SET_ORDER);
:
: preg_match_all will not match beyond WIDGET, the regex "(FORSALE .+
WIDGET)" matches, "(FORSALE.................)" wont work as well. It appears
to blow up at the first sight of numbers.
:
: I've tried this on 3.0.15, .16 and 4.0RC1, using 2 different machines, and
have had the same results.