JS:
urlRegex = new RegExp("(https?://[^/]*(/[^=]*/)*)(.*)");
var urlTmp = url.match (urlRegex);
if (oldFormat == "false"){
return urlTmp[1];
}
else{
return urlTmp[0];
}
转换成JAVA这样对吗?
p = Pattern.compile("(https?://[^/]*(/[^=]*/)*)(.*)");
Matcher urlTmp = p.matcher(rawUrl);
if (oldFormat) {
return urlTmp.group(1);
}
else {
return urlTmp.group(0);
}