übrigens... hab sie nun umgeschrieben
Code: Alles auswählen
;(?=(?:[^"]*"[^"]*")*(?![^"]*"))
Code: Alles auswählen
>>> text = '''"Value1;";"Value2";"""Value3""";"of ""very"" ""difficult""";"";"expressions"
"and";"";"we should not ;""then""; forget";"that it
works ;"
as ""ss""
expected""
"And";"this ""is""";" a";"new start"
"And2";"this is a";"new start as well"
"only "this" line";" is malformat;ted "with" quotes"'''
>>> ptest = re.compile(';(?=(?:[^"]*"[^"]*")*(?![^"]*"))')
>>> re.split(ptest,text)
['"Value1;"', '"Value2"', '"""Value3"""', '"of ""very"" ""difficult"""', '""', '"expressions"\n"and"', '""', '"we should not ;""then""; forget"', '"that it\nworks ;"\nas ""ss""\nexpected""\n"And"', '"this ""is"""', '" a"', '"new start"\n"And2"', '"this is a"', '"new start as well"\n"only "this" line"', '" is malformat;ted "with" quotes"']
Code: Alles auswählen
..."\n"And"'
statt
..." ' , ' "And"'