替换

re =newRegExp("/","g");//第一个参数是要被替换的字符串,第二个参数的“g”表示 所有
str  = str.replace(re,"-");  //用“-”替换所有的“/”
原文地址:https://www.cnblogs.com/peaceshow/p/3532289.html