Efficient String Replacement
Posted: Sun Jan 05, 2014 9:59 pm
Is there any way to make this chunk of code more efficient? I'm not looking for someone to write my code for me, just to point me in the right direction...
Thanks in advance!
Code: Select all
$string = preg_replace('/<ref[^>]*>([\s\S]*?)<\/ref[^>]*>/', '', $string);
$string = preg_replace('/{{(.*?)\}}/s', '', $string);
$string = preg_replace('/File:(.*?)\\n/s', '', $string);
$string = preg_replace('/==(.*?)\=\\n/s', '', $string);
$string = str_replace('|', '/', $string);
$string = str_replace('[[', '', $string);
$string = str_replace(']]', '', $string);
$string = strip_tags($string);