'/xxx/xxx/xxx/xxx/xxx/...', /xxx is greater than or equal to 2, how to get the first two '/xxx/xxx' in the simplest way (without defining extra variables) ?
使用正則/(\/.*?\/.*?)\//
var str = '/xxx/xxx/xxx/xxx/xxx/...';
var reg = /(\/.*?\/.*?)\//;
console.log(str.match(reg)[1])