let b = 'http://www.xx.com/sd/s?s=2'
let c = b.match(/^http[s]?:\/\/(.*)\/(.*)/)
[
'http://www.xx.com/sd/s?s=2',
'www.xx.com/sd',
's?s=2',
index: 0,
input: 'http://www.xx.com/sd/s?s=2',
groups: undefined
]
得到这样的结果。
我这边需要的是sd/s?s=2
请问怎么提取?
解决了: ....match(/^http[s]?:\/\/.*\.[a-z]{2,}\/(.*)/)
match(/^http[s]?:\/\/.*\.[a-z]{2,}\/(.*)/)