can someone transform this ereg_replace expression to preg_replace?
$string = mb_ereg_replace('([ -\.,\+\?\(\)\$\[\];_=])'
.$oldvalue.'([ -\.,\+\?\(\)\$\[\];_=])',"\\1"
.$newvalue."\\2",$string);
Basically it searches a string ($oldvalue) which is preceded by space or dash or fullstop or plus sign开发者_Python百科 or parenthesis or brackets or question-mark or equal sign and is followed by one of these too and transforms it to (whatever was preceding)$newvalue(whatever was following).
I need to switch to preg_replace due to technical limitations, I hope someone can help!
Thank you!
$string = preg_replace('([ -\.,\+\?\(\)\$\[\];_=])'
.$oldvalue.'([ -\.,\+\?\(\)\$\[\];_=])',"$1"
.$newvalue."$2",$string);
Done.
精彩评论