87,901
社区成员
发帖
与我相关
我的任务
分享
var url = "http://sp/sites/PPS-234_343/sdf/34/sdf/786/Documents/Hello World.docx";
console.log(url.split("/sp")[1].split("/sdf")[0]);
var regx = /\/sites\/[^\/]+/;
var regx = /\/sites\/[^\/]+/;
if(regx.test(url)) {
alert(RegExp.lastMatch);
}
alert(regx.exec(url)[0]);