I am trying to parse the following string
s1 = """ "foo","bar", "foo,bar" """
And out put of this parsing I am hoping is...
List ["foo","bar","foo,bar"] length 3
I am able to parse the following
s2 = """ "foo","bar", 'foo,bar' """
By using the following pattern
pattern = "(('[^']*')|([^,]+))"
re.findall(pattern,s2)
gives [('foo', '', 'foo'), ('bar', '', 'bar'), ("'foo,bar'", "'foo,bar'", '')]
But I am not able to figure out the pattern for s2.. Note that I need to parse both s1 and s2 successfully
Edit
The current pattern support strings like
"foo,bar,foo bar" => [foo,bar,foo bar]
"foo,bar,'foo bar'" => ["foo","bar",'foo bar']
"foo,bar,'foo, bar'" => [foo,bar, 'foo, bar'] #length 3

