js替换字符串 str.replace(/需要替换的字符串/g,"新字符串") "yyyy-MM-dd-hh-mm-ss".replace(/-/g,"/") 结果如下: "yyyy/MM/dd/hh/mm/ss"