大家好,又见面了,我是你们的朋友全栈君。
String.prototype.replaceAll = function(regex,replacement){
regex=regex.replace(‘!’,’\\!’).replace(‘@’,’\\@’).replace(‘#’,’\\#’).replace(‘$’,’\\$’)
return this.replace(new RegExp(regex,’gm’),replacement);
};
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/163365.html原文链接:https://javaforall.net