I have a string that may contain double quotes in it. I know I can escape the string by replacing " with \" like:
myString.value.replace(/\"/g, "\\\"");
But doing this can create another issue where if some double quotes are already escaped. For instance if I already have \" in my string, running this will change that to \" which is something I do not want.
Is there a way to ignore already escaped double quotes and only replace the ones that are not ?