title: preg_replace links in text with <a> with some exception
body: <pre><code>&lt;?php
  // I have a string, something like this:
  $string = '
      Lorep ipsum &lt;a href="http://www.example.com"&gt;example&lt;/a&gt; lorem ipsum
      lorem ipsum http://www.example.com/index.php?param1=val&amp;param2=val lorem ipsum
  ';
  // I need to do some magick with preg_replace and get string like this:
  $string = '
      Lorep ipsum &lt;a href="http://www.example.com" target="_blank"&gt;example&lt;/a&gt; lorem ipsum
      lorem ipsum &lt;a href="http://www.example.com/index.php?param1=val&amp;param2=val" target="_blank"&gt;http://www.example.com/index.php?param1=val&amp;param2=val&lt;/a&gt; lorem ipsum
  ';
  
  ?&gt;
  </code></pre>
  
  <p>So basicly, I want to linkify URLs in text that are not wrapped in &lt;a&gt;&lt;/a&gt; and add target="_blank" to those that are.</p>
  
  <p>Can anyone help me with this?</p>