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\"
As @Ev0oD mentioned, the code works perfect except in the following tweet I'm working on:
RT @_Val83_: The cast of #ThorRagnarok playing "Ragnarok Paper Scissors" #TomHiddleston #MarkRuffalo (https://t.co /k9nYBu3QHu)
where the token is going to be removed:
commentstr = commentstr.replaceAll(m.group(i),"").trim();
I have faced the following error:
java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 22
where the m.group(i)
is https://t.co /k9nYBu3QHu
)``