hi I want the code for &b=52&f=norefer and &b=52 [duplicate]
Possible Duplicate:
I want the 开发者_运维百科pattern for removing the &b=128&f=norefer from following url
http://www.yahoo.com/url/5f&b=52&f=norefer
http://www.yahoo.com/url/6aa82d?show=all&page=2&b=52
String finalUrl =decodedUrl.replace("&b=52","");
page.setPageUrl(finalUrl);
I want to remove &b=52&f=norefer
from the first url and &b=52
and from the second url which pattern i will use please give me the code without hard-coded value.
url.replaceFirst("&b=.*", "");
will remove the tail of the string starting from "&b=
". I hope it is good enough for you. At least it is OK for your two exampels and is not sensitive to value of parameter b.
If it is not enough try to describe your task more specifically or just learn a little bit regular expressions.
精彩评论