Javascript 如何对字符串使用replace()方法一次而不是多次?

Javascript 如何对字符串使用replace()方法一次而不是多次?,javascript,string,replace,str-replace,regexp-replace,Javascript,String,Replace,Str Replace,Regexp Replace,str是一个html字符串(或包含完整html的字符串),但中间有一些我试图摆脱的不需要的代码 到目前为止,这是对我有效的方法: const contentClean = str.replace(/=0A/gm,"").replace(/(=09)/gm,"").replace(/(=\r\n)/gm,"").replace(/(3D)/gm,""); 如何在上面的代码中只编写一次而不是4次replace()方法?只需使用在每种可能性之间交替: const contentClean = str

str
是一个html字符串(或包含完整html的字符串),但中间有一些我试图摆脱的不需要的代码

到目前为止,这是对我有效的方法:

const contentClean = str.replace(/=0A/gm,"").replace(/(=09)/gm,"").replace(/(=\r\n)/gm,"").replace(/(3D)/gm,"");

如何在上面的代码中只编写一次而不是4次replace()方法?

只需使用
在每种可能性之间交替:

const contentClean = str.replace(/=0A|=09|=\r\n|3D/gm, "");
请注意,不需要捕获组