I have a bit of a problem that requires Regular Expressions and I haven't used them often enough to know how to do this. I'm using Python to split strings in a file, but I want to split the strings on commas, like so:
' item1, "item2", "item3", "item4, item4 more stuff", null, "states: IL, AL, CO, etc. item5, (more extraneous punctuation)" '
Where the enclosing single quotes represent the string I mentioned, and I basically want to split the string on commas - however not the commas that are inside quotation marks ("states: IL, AL, CO, etc ...").
Basically what I'd like to get back is an array with the following 6 items from the example string above:
item1, "item2", "item3", "item4. item4 more stuff", null,
"states: IL, AL, CO, etc. item5, (more extraneous punctuation)"
So essentially its just the commas inside the quotation marks which are ignored, only the commas on the outside are used. Any help is greatly appreciated, thanks.