preg_replace dont replace values
<p>I wrote a function to strip parameters from urls, the function looks like this </p>

<pre><code>function remove_it($c_link){

        $regex = array();
        $award = array();

        $regex[] = '/[\?&amp;](?&lt;name&gt;sa)=(?&lt;value&gt;[^&amp;=]+)/';
        $regex[] = '/[\?&amp;](?&lt;name&gt;ei)=(?&lt;value&gt;[^&amp;=]+)/';
        $regex[] = '/[\?&amp;](?&lt;name&gt;ved)=(?&lt;value&gt;[^&amp;=]+)/';
        $regex[] = '/[\?&amp;](?&lt;name&gt;usg)=(?&lt;value&gt;[^&amp;=]+)/';

        foreach($regex as $remove){

            $c_link = preg_replace($remove,'',$c_link);

        }

        return $c_link;

    }
</code></pre>

<p>When I use a testurl like this</p>

<pre><code>$test = 'http://forum.gofeminin.de/forum/dietetique/__f2955_dietetique-Diatpillen.html&amp;sa=U&amp;ei=8doOUa6HOsfKtAaDpICIBQ&amp;ved=0CB0QFjAA&amp;usg=AFQjCNEcFS48QvteNkSNcszXv5RG6VUe2g';
</code></pre>

<p>It's woking perfect. Now I wanted to use it in my code. So I called to function with my data and it doesn't affect the string. I used print_r to see if the string looks strange, but it's just 1:1 like in $test </p>

<pre><code>$TEST-&gt; http://forum.gofeminin.de/forum/dietetique/__f2955_dietetique-Diatpillen.html&amp;sa=U&amp;ei=C9wOUZuvCoeQtQavpoHoDg&amp;ved=0CB0QFjAA&amp;usg=AFQjCNHkRBKRpZXZX7idJ6YmSG0AIxtOdw
print_r-&gt; http://forum.gofeminin.de/forum/dietetique/__f2955_dietetique-Diatpillen.html&amp;sa=U&amp;ei=C9wOUZuvCoeQtQavpoHoDg&amp;ved=0CB0QFjAA&amp;usg=AFQjCNHkRBKRpZXZX7idJ6YmSG0AIxtOdw
</code></pre>

<p>As I used all debugging methods that I know of, I don't really know where I should start searching... any pointers ?</p>

<p>I made antoher testrun, and saved all data in an array, later on I wanted to stript the parameter for 1 url. Here the testcode:</p>

<pre><code>    echo '&lt;pre&gt;';
    print_r($test).'&lt;/br&gt;';
    echo remove_it($test[0]);
    echo '&lt;/pre&gt;';
    break;
</code></pre>

<p>the output was like : </p>

<pre><code>Array
(
    [0] =&gt; http://forum.gofeminin.de/forum/dietetique/__f2955_dietetique-Diatpillen.html&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CDUQFjAA&amp;usg=AFQjCNGgMS-nHM2JY_PkIt7C_RT2dr9bUw
    [1] =&gt; http://www.fitforfun.de/abnehmen/gesund-essen/diaetpillen/diaetpillen-appetitzuegler_aid_2100.html&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CEEQFjAB&amp;usg=AFQjCNG60KJy3wLR8DnLm9gKQEn-uR6l3w
    [2] =&gt; http://www.stern.de/ernaehrung/uebergewicht-abnehmen/diaetpillen-check-welche-mittel-machen-duenn-das-abc-der-schlankmacher-615772.html&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CEYQFjAC&amp;usg=AFQjCNGLzi5UMG4g5INDkeBdMpENgY4gHg
    [3] =&gt; http://getslim.de/diaetpillen-im-test&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CEoQFjAD&amp;usg=AFQjCNEcZnpSlVVxLgskK9DfhBF9AHGC2w
    [4] =&gt; http://www.br.de/fernsehen/bayerisches-fernsehen/sendungen/gesundheit/themenuebersicht/medizin/schlankheitspillen-diaet-tabletten100.html&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CFQQFjAE&amp;usg=AFQjCNHujKjdfNsOkarYf6MwHCPODcISjw
    [5] =&gt; http://www.diaetpillenvergleich.de/beste-diatpillen/&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CFoQFjAF&amp;usg=AFQjCNFBgbYjgutHJfp-eQztXTsKYk7rTw
    [6] =&gt; http://www.diaetpillen-online.de/&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CF4QFjAG&amp;usg=AFQjCNF083onO0rkMuQjY0tEIhhdSM4Igg
    [7] =&gt; http://diaet.erdbeerlounge.de/Diaetpillen/&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CGIQFjAH&amp;usg=AFQjCNFhNr-gsFxK1-vfjhnC1A5qQi1ZjQ
    [8] =&gt; http://diaet.erdbeerlounge.de/abnehmen-forum/Diaetpillen-_t2698848s1&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CGcQFjAI&amp;usg=AFQjCNHhHY3zUnJtwF6-HV-DbsxaVUFxsg
    [9] =&gt; http://www.gutefrage.net/tag/diaetpillen/1&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CG0QFjAJ&amp;usg=AFQjCNHPYODXZA1Sa2rs6ItnUWTOYkJj3w
)
http://forum.gofeminin.de/forum/dietetique/__f2955_dietetique-Diatpillen.html&amp;sa=U&amp;ei=LOIOUaqQGITntQbmmIHYBQ&amp;ved=0CDUQFjAA&amp;usg=AFQjCNGgMS-nHM2JY_PkIt7C_RT2dr9bUw
</code></pre>
