Jump to content

preg replace


perezf

Recommended Posts

you just want to replace that one email address with the other?  is it alone in a variable or contained in a string?

 

Lets assume it's contained in a string with other stuff.  Since it is a simple match and replace, use str_replace instead, as it's MUCH quicker then preg_replace... only use preg functions if you have to.

 

$string = str_replace("[email protected]", "[email protected]", $string);

Link to comment
https://forums.phpfreaks.com/topic/112931-preg-replace/#findComment-580090
Share on other sites

can you post the input string?  preg_replace will do the exact same thing when it's just looking for a string.  If str_replace doesn't work, preg_replace probably won't either.

 

run:

echo $string;
$string = str_replace("[email protected]", "[email protected]", $string);

echo $string;

 

and post what the result is

 

Link to comment
https://forums.phpfreaks.com/topic/112931-preg-replace/#findComment-580104
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.