Thread: quoted csv to array pattern

quoted csv to array pattern

From
Michael Moore
Date:
I am trying to use
SELECT regexp_split_to_table('''quick brown'', ''fox'' ''over, dog''',  ','); 

I need the output to be:
quick brown
fox
over, dog

Google was no help.
Thanks,
Mike

Re: quoted csv to array pattern

From
"David G. Johnston"
Date:
On Wed, May 25, 2016 at 7:25 PM, Michael Moore <michaeljmoore@gmail.com> wrote:
I am trying to use
SELECT regexp_split_to_table('''quick brown'', ''fox'' ''over, dog''',  ','); 

I need the output to be:
quick brown
fox
over, dog


You cannot reliably/easily parse/split CSV with embedded delimiters using regex...you can cheat a bit if your data allows by making the delimiter <', '> instead of just <,>

David J.


 

Re: quoted csv to array pattern

From
Michael Moore
Date:
Well, that explains why I couldn't find a solution. Thanks David

On Wed, May 25, 2016 at 4:34 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wed, May 25, 2016 at 7:25 PM, Michael Moore <michaeljmoore@gmail.com> wrote:
I am trying to use
SELECT regexp_split_to_table('''quick brown'', ''fox'' ''over, dog''',  ','); 

I need the output to be:
quick brown
fox
over, dog


You cannot reliably/easily parse/split CSV with embedded delimiters using regex...you can cheat a bit if your data allows by making the delimiter <', '> instead of just <,>

David J.