var a = "(ddd)";
a = a.replace(/\(|\)/g, "");
console.debug(a);//全局替换 ddd
a = "(ddd)";
a = a.replace(/\(|\)/, "");//只能替换到前面的()
console.debug(a);// ddd)
var a = "(ddd)";
a = a.replace("(", "");//非正则表达式替换
console.debug(a);// ddd)
image.png
网友评论