我想要的结果 求个正则 const s = '/hello' // match[1] = hello const s = '/hello/abcd' // match[1] = hello // match[2] = /abcd const s = '/hello/' // match[1] = hello // match[2] = / console.log(s.match(/\/([^\/]+)?(.+)/i))