str = "toQuotenotToQuote" quotedStr = str.replace(/(toQuote)/g, '"$1"') console.log(quotedStr) // "toQuote"notToQuote