Jump to content

Convert working eregi_replace to preg_replace


kidrobot2008

Recommended Posts

I need help converting the following working statement so it uses preg_replace instead.

 

$text = "I love PHP Freaks.";

$text = ' '. $text .' ';

$words = "PHP Freaks";

$link = "<a href=http://www.phpfreaks.com>PHP Freaks</a>";

$text = eregi_replace("([ ,\.\?!:\(\)\r\n\<\>])". preg_quote($words) ."([ ,\.\?!:\(\)\r\n\<\>])", "\\1". ($link) ."\\2", $text);

 

In the real deal $text is a paragraph of text and $words is a name.

 

Thanks in advance.

K

 

 

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.