js 中替換全部字符串

var a="hello world ! 你好,世界!hello world!"; a.replace(/你好,世界/g,'我是誰');   //"hello world ! 我是誰!hello world!" a.replace(/hello/g,'你好'); //"你好 world ! 你好,世界!你好 world!"     其中替換特殊字符需要轉義:
相關文章
相關標籤/搜索