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";
using a regular expression?
I want to remove all the URLs in the text. But it's not working, my code is :
String pattern = "(http(.*?)\s)";
Pattern pt = Pattern.compile(pattern);
Matcher namemacher = pt.matcher(input);
if (namemacher.find()) {
str=input.replace(namemacher.group(0), "");
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…