Marcus Engene <mengpg2(at)engene(dot)se> writes:
> I would like to have a function like the above that returns "innan klas"
> for this data. I would have expected it to as I use the non greedy version.
regression=# select
regexp_replace
('innan[noindex]apa[/noindex]klas[noindex]banan[/noindex]',
'\\[noindex\\].*?\\[/noindex\\]',
' ', 'g');
regexp_replace
----------------
innan klas
(1 row)
regards, tom lane