title: PHP preg_replace - www or http://
body: <p>Really stuck on what seems to be something simple. I have a chatbox/shoutbox where there may be arbitrary URLs entered. I want to find each individual URL (separated by spaces) and wrap it in tags.</p>
  
  <p>Example: <code>Harry you're a <a href="http://google.com" rel="nofollow">http://google.com</a> wizard!</code> = <code>Harry you're a $lhttp://google.com$l wizard!</code></p>
  
  <p>Example: <code>Harry you're a <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> wizard!</code> = <code>Harry you're a $lhttp://www.google.com$l wizard!</code></p>
  
  <p>Example: <code>Harry you're a www.google.com wizard!</code> = <code>Harry you're a $lwww.google.com$l wizard!</code></p>
  
  <p>Sorry if this is a daft question; I'm just trying to make something work and I'm no php expert :(</p>