Assuming is Javascript & you only want to remove offset param:
str.replace(\offset=[0-9]*&?\,"")
For Java:
str=str.replaceAll("offset=[0-9]*&?","");
//to remove & and ? at the end in some cases
if (str.endsWith("?") || str.endsWith("&"))
str=str.substring(0,str.length()-1);