How to parse SQL containing paired single quotes?
Posted on 2009-03-31
I need to parse strings of the form
SELECT * FROM Table WHERE x='foo', y='foo''bar', z='bar'
and have the following matches returned by regex.split:
'foo', 'foo''bar', 'bar'
I've tried regex ('.*?') to return the quote-delimited strings, but it barfs on the single-quote pair and returns
'foo', 'foo', 'bar', 'bar'
Can someone suggest a way to do this? Thanks.