mengelilingi substring dengan kutipan

str = "toQuotenotToQuote"

quotedStr = str.replace(/(toQuote)/g, '"$1"')

console.log(quotedStr) // "toQuote"notToQuote
Anxious Alpaca