Hi

I am having some problems with preg_replace and I wondering if someone could suggest a fix or explain why it is not working.



Here is the Code:
*********************
<?php
$code = "blah http://www.foo.com/Unsubscribe.php?EmailAddress=[MAIL] blah";
$url = "'http://www.foo.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL]'";
echo "BEFORE : $code<br><br>";
$replace  = "Foo";
$code = preg_replace($url,$replace,$code,1);
echo "AFTER: $code<br>";
?>
**********************

Here is the results of the script:

**********************
BEFORE : blah http://www.qxlmaxbid.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL] blah


AFTER: blah http://www.qxlmaxbid.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL] blah

**********************

It should give the following result:

**********************

AFTER: blah Foo blah

**********************

Thanks for your help

Regards

John Clegg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to