'/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) ?
我想大声告诉你2017-06-12 09:29:43
使用正则/(\/.*?\/.*?)\//
var str = '/xxx/xxx/xxx/xxx/xxx/...';
var reg = /(\/.*?\/.*?)\//;
console.log(str.match(reg)[1])