I cannot make regexp and preg_replace work
<p>Any ideas why this wouldn't output anything?</p>

<p>I just want to remove /page/* part of the url.</p>

<p>My aim is to get always <a href="http://www.sandrophoto.com/category/car-photography/" rel="nofollow">http://www.sandrophoto.com/category/car-photography/</a> even if string contains longer url.</p>

<p>I tried:</p>

<pre><code>&lt;?php

$url1 = "http://www.sandrophoto.com/category/car-photography/page/1/";
$url2 = "http://www.sandrophoto.com/category/car-photography/page/2/";
$url3 = "http://www.sandrophoto.com/category/car-photography/";

$cleaned1 = preg_replace('/page/*', '', $url1);
$cleaned2 = preg_replace('/page/*', '', $url2);
$cleaned3 = preg_replace('/page/*', '', $url3);

echo "$cleaned1 &lt;br&gt;";
echo "$cleaned2 &lt;br&gt;";
echo "$cleaned3 &lt;br&gt;";

?&gt;
</code></pre>
