Ikke om regexp, men det virker
create or replace function split_csv(
line text,
delim_char char(1) = ',',
quote_char char(1) = '"')
returns setof text[] immutable language plpythonu as $$
import csv
return csv.reader(line.splitlines(), quotechar=quote_char, delimiter=delim_char, skipinitialspace=True, escapechar='\\')
$$;
select *, x[4] from split_csv('field1|"field2"|field3|"22 \" lcd \| screen "'||E'\n'||'a|b', delim_char := '|') as x;
╔═════════════════════════════════════════════════════════════════ ╤════════════════════╗║ x │ x ║╠══════════════════════ ║ felt2,felt3,"22 \" lcd | skærm "} │ 22" lcd | skærm ║║ {a,b} │ ░░░░ ║╚══════════════════════════════════════════ ═══════════╧══════════════════╝pre