replace("待替换字符串","替换字符串") 替换匹配到的第一个
replace(new RegExp("待替换字符串","gm"),"替换字符串");替换所有匹配到的
var str='2014-10-22';
str.replace("-","/"); 结果-->2014/10-22
str.replace(new RegExp("-","gm"),"/"); 结果-->2014/10/22
var str='2014-10-22';
str.replace("-","/"); 结果-->2014/10-22
str.replace(new RegExp("-","gm"),"/"); 结果-->2014/10/22