Page 1 of 1

Efficient String Replacement

Posted: Sun Jan 05, 2014 9:59 pm
by abreksa4
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...

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);
Thanks in advance!

Re: Efficient String Replacement

Posted: Tue Jan 07, 2014 1:44 pm
by abreksa4
Well, some very nice users over at stackoverflow were able to answer my question...

Here's the link if anyone else has the same question: http://stackoverflow.com/questions/2097 ... ent-in-php