JS替换不起作用

时间:2015-10-12 12:29:33

标签: javascript

我尝试从div替换一些文本,例如从控制台替换:

>"<br>* Please add email(s)!<br>* Please add email(s)!".replace(/<br>* Please add email(s)!/g,'')

结果:

<-"<br>* Please add email(s)!<br>* Please add email(s)!"

1 个答案:

答案 0 :(得分:2)

将正则表达式修复为/<br>\* Please add email\(s\)!/g,尝试:

"<br>* Please add email(s)!<br>* Please add email(s)!<br>* Please add email(s)!<br>* Please add email(s)!".replace(/<br>\* Please add email\(s\)!/g,'')