正则替换所有的 ‘ / ’

用正则表达式
var a="a/b/c/d";
console.log(a.replace(/\//g,'-'));

结果:a-b-c-d

posted @ 2019-10-29 15:13  一城柳絮吹成雪  阅读(2076)  评论(0编辑  收藏  举报