Convert eregi_replace to preg_replace

Hi guys,

My host has recently upgraded to PHP 5.3 - unfortunately this has created a lot of PHP warnings on my site.

Deprecated: Function eregi() is deprecated

I’m a complete newbie when it comes to writing PHP would any gurus be able to convert these lines to “preg_replace” it’s my understanding that this will then fix the warnings.

$path = eregi_replace('^index2?.php', '', $path);
$newurl = eregi_replace("(&|\\?)$var=[^&]*", '\\\\1', $url);
$newurl = eregi_replace("(&|\\?)$var=$value(&|\\$)", '\\\\1\\\\2', $url);

Thank you so much for any help!

managed to resolve hopefully. This post was of great help for anyone stuck with a similar issue.

Just the answer I need. I got my hosting to return to 5.2 for short term cure.