开发者

I want the regular expression for removing the &b=some value

I have the url http://www.yahoo.co开发者_StackOverflowm;b=&90

I want to remove the b=&90 without hardcoading value

String finalUrl =decodedUrl.replace("&b=90","");
                page.setPageUrl(finalUrl);


If you mean that your URL looks like http://www.yahoo.com&b=90 and you wish to remove all parameters use the following code snippet: url.replaceFirst("&.*", ""). If you wish to remove the parameter b only and do not want to remove other parameters that may be before and after taking into consideration that the parameter may be the first, last and in the middle the regular expression will be more complicated and requires some debugging. Please say if you need this and I will help you.


To replace parameters called b that aren't the first parameter, you could try:

&b=.+$
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜