Javascript替换字符串中不按预期工作的多个字符

Javascript替换字符串中不按预期工作的多个字符,javascript,Javascript,将和替换为空格“”,将替换为\n var a = "Welcome to xyz. You have been added as a manager by <b>Adam </b>.<br><br><b>Dashboard Link:</b> https://app.xyz.com <br><br>Use the credentials below to sign-in: <br><

替换为空格“”,将

替换为\n

var a  = "Welcome to xyz. You have been added as a manager by <b>Adam </b>.<br><br><b>Dashboard Link:</b> https://app.xyz.com <br><br>Use the credentials below to sign-in: <br><b>Username : </b>a@k.com<br><b>Password : </b>qwerty";

var b = a.replace("<b>|</b>"," ").replace("<br>","\n");
console.log(b);
var a=“欢迎来到xyz。Adam已将您添加为经理。
仪表板链接:https://app.xyz.com

使用以下凭据登录:
用户名:a@k.com
密码:qwerty”; 变量b=a.replace(“|”,”).replace(“
”,“\n”); 控制台日志(b);
@重复您可以使用正则表达式或slit and joint函数来实现它。对于多字符,请使用正则表达式“|”替换文字字符串
“|”
。您需要一个正则表达式。请您提供@Xufox
/|/g
.var a=“欢迎来到xyz。您已被Adam添加为经理。

仪表板链接:

使用以下凭据登录:
用户名:a@k.com
密码:qwerty”;变量b=a.replace(/|/g,“”).replace(/
/g,“\n”);控制台日志(b);工作