In this case, I want to replace linefeeds(\n) to @ but not \n used inside the variable. Are there any ways to distinguish linefeeds from \n inside the code?
For example, I don't want to replace \n inside this: alert("abc \n cde")
let my_code = `
alert("abc \n cde");
alert("efd \n hij");
alert("klm \n opq");
alert("stu \n vwx");
`;
console.log( my_code )
my_code = my_code.replace(/\n/g, '@');
console.log( my_code )
online code editor: https://jsfiddle.net/r6La9mz2/