title: Removing the url from text using java
body: <p>How to remove the URLs present in text example</p>
  
  <pre><code>String str="Fear psychosis after #AssamRiots - http://www.google.com/LdEbWTgD http://www.yahoo.com/mksVZKBz";
  </code></pre>
  
  <p>using a regular expression?</p>
  
  <p>I want to remove all the URLs in the text. But it's not working, my code is :</p>
  
  <pre><code>String pattern = "(http(.*?)\\s)";
  Pattern pt = Pattern.compile(pattern);
  Matcher namemacher = pt.matcher(input);
  if (namemacher.find()) {
    str=input.replace(namemacher.group(0), "");
  }
  </code></pre>