PHP preg_replace LINK only
<p>I'm trying to preg_replace to detect a link in a string. Example below</p>

<pre><code>$descriptionlink = "This is a test www.google.com";
$descriptionlink = preg_replace('/.*?\b((?:(?:https?|ftp|file):\/\/|www\.|ftp\.)?[-A-Z0-9+&amp;@#\/%=~_|$?!:,.]*[A-Z0-9+&amp;@#\/%=~_|$]\.[-A-Z0-9+&amp;@#\/%=~_|$?!:,.]*[A-Z0-9+&amp;@#\/%=~_|$]).*?/i', '$1', $descriptionlink);
</code></pre>

<p>It works great if there is a link in the string and echos out only the link like I want it. Now if the string is just text it will echo out the text. If it doesn't have a link I don't want to see the text in the string.</p>

<p>example of outputs I want</p>

<pre><code>input - This is a test www.google.com
output - www.google.com
</code></pre>

<p>That above works great but it will do this and echo out the text below if no link</p>

<pre><code>input - This is a test
output - This is a test
</code></pre>

<p>I want the output to be blank if it's just text.</p>

<p>Thanks</p>
