0

I want to replace all newlines that are NOT inside quotation marks.

The following works in regex101: $(?=(?:[^"]"[^"]")[^"]$)

However, when I use it in a Python script, the result is different. How do I rewrite this line, so it is able to locate all newlines that are not in quotation marks?

As an example, I only want to find the first newline in the following text:

value 1, value 2, value 3 \n

value 4, "some string containing a \n

newline"

0 Answers0