Removing the url from text using java

前端 未结 7 1794
梦毁少年i
梦毁少年i 2020-12-15 07:59

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\"         


        
7条回答
  •  时光说笑
    2020-12-15 08:29

    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)
    

提交回复
热议问题