let str = "sdfsfwwxxxfsfsxxdsdfwsdfxxxxa3sdswexxxxsdfsxxxxfa"let newStr = str.replace(new RegExp(/xxx/g), "YYY") console.log(newStr)