How to remove the URLs present in text example
String str=\"Fear psychosis after #AssamRiots - http://www.google.com/LdEbWTgD http://www.yahoo.com/mksVZKBz\"
If you can move on towards python then you can find much better solution here using these code,
import re text = " then ftp and mailto and gopher and file ftp://ideone.com/K3Cut rthen you " text = re.sub(r"ftp\S+", "", result) print(result)