The following code is replacing opening and closing straight double quotes by opening and closing curly double quotes:
const string = `Not dialogue not dialogue.
"Dialogue dialogue.
"Dialogue dialogue."
"Dialogue," not dialogue. "Dialogue."`
const result = string.replace(/"([^"\n\r]*)"/g, '“$1”')
console.log(result)
How to modify this code so the opening straight double quote in "Dialogue dialogue (second line) is also replaced by an opening curly double quote (without adding a closing curly double quote at the end of the line)?
Desired output:
Not dialogue not dialogue.
“Dialogue dialogue.
“Dialogue dialogue.”
“Dialogue,” not dialogue. “Dialogue.”