regex for postgres array

I am using ORM which doesn’t support postgres array, so I am trying to do some hacks to add “support”.

Currently I have to convert postgres array string into array of programming language.

Example of postgres array string representation:

{"bla, bla",bla,"bu bu",bu}

So if there are spaces, postgres is automatically adding quotes, if not, then element is without quotes.

What regex you would use to get array out of this? So result should be:

array := []{"bla, bla", "bla", "bu bu", "bu"}

I am using Go.

Arrays are one dimensional, so something like:

CREATE TABLE test (
something text[]
);


Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.