Rocko Jedi Rocko Jedi - 5 months ago 10
PHP Question

eregi_replace deprecated

Possible Duplicate:

Deprecated: Function eregi_replace()

I have an error that reads:

Deprecated: Function ereg_replace() is deprecated in /home/socia125/public_html/wi_class_files/autoMakeLinks.php on line 26

My code is here. Any help is appreciated.


class autoActiveLink {

function makeActiveLink($originalString){

$newString = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a

href=\"\\0\" target=\"_blank\">\\0</a>", $originalString);
return $newString;



Using preg_replace:

$newString = preg_replace("#[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]#","<a href=\"\\0\" target=\"_blank\">\\0</a>", $originalString);