摘要: 以下函数将替换英文方式下的单引号和双引号,当然change函数编写决定了你要替换什么?String.prototype.repSpecChar=function() { filterChar="'|\"";//需要过滤的字符 //var reg=new RegExp("(')|(\")","g"); var reg=new RegExp(filterChar,"gm"); var newstr= this.replace(reg,change); return newstr; } 阅读全文