I want the pattern for removing the &b=128&f=norefer from following url

后端 未结 3 1902
遇见更好的自我
遇见更好的自我 2020-12-22 11:45

http://www.yahoo.com &b=128&f=norefer

I want to remove &b=128&f=norefer

String finalUrl =decodedUrl.repl         


        
3条回答
  •  太阳男子
    2020-12-22 12:21

    You can use the following regex replacement to remove everything after the first ampersand:

    "http://www.yahoo.com &b=128&f=norefer".replaceAll("&.*$", "");
    

提交回复
热议问题