For example, I want to split
str = '"a,b,c",d,e,f'
into
["a,b,c",'d','e','f']
(i.e. don't split the quoted part) In this case, this can be done with
re.findall('".*?"|[^,]+',str)
However, if
str = '"a,,b,c",d,,f'
I want
["a,,b,c",'d','','f']
i.e. I want a behavior that is like python's split function. Is there any way I can do this in one (small) line, possibly using Python's re library?
Actually, I just realized (on this site) that the csv module is perfect for what I want to do, but I am curious whether there is a regular expression that re can use to do it as well.