Java : replacing text URL with clickable HTML link

前端 未结 6 769
不知归路
不知归路 2020-12-20 13:54

I am trying to do some stuff with replacing String containing some URL to a browser compatible linked URL.

My initial String looks like this :

\"hell         


        
6条回答
  •  情歌与酒
    2020-12-20 14:07

    Assuming your regex works to capture the correct info, you can use backreferences in your substitution. See the Java regexp tutorial.

    In that case, you'd do

    myString.replaceAll(....., "\1")
    

提交回复
热议问题