Using regexp_replace on array column in postgres

Viewed 2264

I am trying to update all occurrences of some value in every element of an array column using a regexp.

If the column was not of type text[] and text instead I would use this query to update:

UPDATE my_table
SET my_column = regexp_replace(
    my_column, 'foo(\d+)', 'bar\1', 'g'
)

How can I replace each element in an array column?

2 Answers
Related