原(https://baidu.com/aa/#/home?f...)
取到 /home 这些用/index替换
替换为(https://baidu.com/aa/#/index?...)
想替换掉/到?这一块就是网址有可能是(https://baidu.com/aa/#/home?f...)也可能是(https://baidu.com/aa/#/demo?f...)用index把上面两个例子的home和index 这个位置的内容替换掉
var a = 'https://baidu.com/aa/#/home?flag=bb' a.replace(//home/, '/index')
是我的错觉吗, 还是有什么我没看懂的
var a = 'https://baidu.com/aa/#/home?flag=bb' a.replace(/#(.*?)?/, '#/index?')
2.1m questions
2.1m answers
63 comments
56.6k users