In PostgreSQL, regexp_replace behavior alters if it is either replacing a white-spaced string in a string array with a blank string or null.
1 - Replacing a white-spaced string with blank
SELECT regexp_replace(UNNEST('{NULL, "ABC", " "}'::text[]), '^\s+$', '', 'g')
Expected result: {NULL,"ABC",""}
Result: {NULL,"ABC",""} <-- Working as it should
2 - Replacing a white-spaced string with null
SELECT regexp_replace(UNNEST('{NULL, "ABC", " "}'::text[]), '^\s+$', NULL, 'g')
Expected result: {NULL,"ABC",NULL}
Result: {NULL} <-- Deleted other information
Thank you for all the help in advance.