javascript 字符替换 replace 方法

语法:stringObj.replace(rgExp, replaceText)
用str.replace("|",",") 只会替换第一个匹配的字符, str.replace(/\|/g,",")则可以替换掉全部匹配的字符(g为全局标志)。
原文地址:https://www.cnblogs.com/flycantus/p/1239754.html