How to remove everything but URL PHP
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1141848/regex-to-match-url">Regex to match URL</a>  </p>
</blockquote>



<p>I know regexp should be able to do this but I can't figure out how to do it. I wan't to be able to search through a string of text and return only the url's. How would you do this in PHP?</p>

<h1>Example</h1>

<pre><code>hello there everyone visit this link: http://google.com and this one as well http://amazon.com
</code></pre>

<p>would return:</p>

<p><a href="http://google.com" rel="nofollow">http://google.com</a></p>

<p><a href="http://amazon.com" rel="nofollow">http://amazon.com</a></p>

<p>Any ideas?</p>
