I have a string like:
 {'the','dog\'s','bite'}
or maybe:
 {'the'}
or sometimes:
 {}
[FYI: this is postgresql database "array" field output format]

which I'm trying to parse with the re module.
A single quoted string would, I think, be:
 r"\{'([^']|\\')*'\}"

but how do I represent a *sequence* of these separated
by commas?  I guess I can artificially tack a comma on the
end of the input string and do:

 r"\{('([^']|\\')*',)\}"

but that seems like an ugly hack...

I want to end up with a python array of strings like:

['the', "dog's", 'bite']

Any simple clear way of parsing this in python would be
great; I just assume that "re" is the appropriate technique.
Performance is not an issue.

-- George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to