title: Split by space but not newline
body: <p>I am trying to convert all links in a given string to clickable <code>a</code> tags using the following code :</p>
  
  <pre><code>String [] parts = comment.split("\\s");
  String newComment=null;
  
  for( String item : parts ) try {
      URL url = new URL(item);
      // If possible then replace with anchor...
      if(newComment==null){
          newComment="&lt;a href=\"" + url + "\"&gt;"+ url + "&lt;/a&gt; ";    
      }else{
          newComment=newComment+"&lt;a href=\"" + url + "\"&gt;"+ url + "&lt;/a&gt; ";    
      }
  } catch (MalformedURLException e) {
      // If there was an URL that was not it!...
      if(newComment==null){
          newComment = item+" ";
      }else{
          newComment = newComment+item+" ";
      }
  }
  </code></pre>
  
  <p>It works fine for</p>
  
  <pre><code>Hi there, click here http://www.google.com ok?
  </code></pre>
  
  <p>converting it to </p>
  
  <pre><code>Hi there, click here &lt;a href="http://www.google.com"&gt;http://www.google.com&lt;/a&gt; ok?
  </code></pre>
  
  <p>But when the string is this :</p>
  
  <pre><code>Hi there, click 
  
  here http://www.google.com 
  
  ok?
  </code></pre>
  
  <p>its still converting it to :</p>
  
  <pre><code>Hi there, click here &lt;a href="http://www.google.com"&gt;http://www.google.com&lt;/a&gt; ok?
  </code></pre>
  
  <p>Whereas I want the final result to be :</p>
  
  <pre><code>Hi there, click 
  
  here &lt;a href="http://www.google.com"&gt;http://www.google.com&lt;/a&gt; 
  
  ok?
  </code></pre>
  
  <p>I think its including the newline character also while making the split.</p>
  
  <p>How do I preserve the newline character in this case ?</p>