eregi_replace / preg_match_all
| From: | Jennifer Swofford | Date: | Tue, 01 Oct 2002 20:20:57 +0000 |
| Subject: | eregi_replace / preg_match_all | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-118424@lists.php.net to get a copy of this message | ||
Why does this work:
$contents =
eregi_replace("(\")(.(/))*[A-Z0-9_/-]+(.gif|.jpg)",
"\"blah.gif", $contents);
But this does not:
preg_match_all("(\")(.(/))*[A-Z0-9_/-]+(.gif|.jpg)",
$contents, $matches);
for ($i=0; $i< count($matches[0]); $i++) {
echo "matched: ".$matches[0][$i]."\n"
}
I get this error:
Warning: Unknown modifier '(' in
/home/littleduck/www/www/newcontrol/temp/fread.php on
line 20
The first example finds/replaces fine. The second
does not find at all. (If I replace the regular
expression string with something simple like
"(gif|jpg)" it works.)
Thank you for any hints!
Jen
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com