我想要的结果 求个正则
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))
1
jackmod 2021-11-21 21:56:00 +08:00
^/([^/]*)(.*)$
|