Regular expression that splits CSV string into table

From: Nick <nboutelier(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Regular expression that splits CSV string into table
Date: 2010-09-10 22:43:20
Message-ID: 937000a6-1430-438e-a0b5-ef3a66d86321@k17g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What would be the regexp_split_to_table pattern that splits a comma
separated string into a table? Im having trouble when a string
contains commas or there are commas at the beginning or end

String
',one,two,''three,four'',five,six,'

Should return
,one
two
three,four
five
six,

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2010-09-10 23:43:58 Re: Regular expression that splits CSV string into table
Previous Message Dmitriy Igrishin 2010-09-10 20:29:46 Re: regexp on null