title: Replace URL in text with href (in Java)
body: <p>I have to tranform url's entered in plain text into html hrefs and I want to find multiple urls.</p>
  
  <p>This:
      <code>Hi here is a link for you: http://www.google.com. Hope it works.</code></p>
  
  <p>Will become:
      <code>Hi here is a link for you: &lt;a href='http://www.google.com'&gt;http://www.google.com&lt;/a&gt;. Hope it works.</code></p>
  
  <p>Found this code:</p>
  
  <pre><code>public String transformURLIntoLinks(String text){
  String urlValidationRegex = "(https?|ftp)://(www\\d?|[a-zA-Z0-9]+)?.[a-zA-Z0-9-]+(\\:|.)([a-zA-Z0-9.]+|(\\d+)?)([/?:].*)?";
  Pattern p = Pattern.compile(urlValidationRegex);
  Matcher m = p.matcher(text);
  StringBuffer sb = new StringBuffer();
  while(m.find()){
      String found =m.group(0); 
      m.appendReplacement(sb, "&lt;a href='"+found+"'&gt;"+found+"&lt;/a&gt;"); 
  }
  m.appendTail(sb);
  return sb.toString();
  }
  </code></pre>
  
  <p>Posted here <a href="https://stackoverflow.com/a/17704902">https://stackoverflow.com/a/17704902</a></p>
  
  <p>And it works perfectly. For all urls properly prefixed with <code>http</code>.
  But I also want to find url's starting with just <code>www</code>.</p>
  
  <p>Can anyone that knows his regex help me out?</p>