skip to Main Content

Postgresql – Split string using Regex in Postgres function

I need help splitting the string below using REGEXP_SPLIT_TO_ARRAY in a Postgres function: keyone="valone" key_two="val two" KEY_THREE=val three keyfour="http://sample.domain?par1=val1&par2=val2" keyFIVE=valfive and the resultant array should look like this: (keyone="valone",key_two="val two",KEY_THREE=val three,keyfour="http://sample.domain?par1=val1&par2=val2",keyFIVE=valfive) I ended up with this myarray := REGEXP_SPLIT_TO_ARRAY(mystring, E'\s(?=([^"]*"[^"]*")*[^"]*$)');…

VIEW QUESTION
Back To Top
Search