I have a table which stores strings in array. Couldn't figure it out why but simple example looks like that:
+--------+----------------------------------+
| reason | string |
+--------+----------------------------------+
| \N | \N\N\N\NXXX - ABCDEFGH\N\N |
| \N | \N\N\N\NXXX - ABCDEFGH |
| \N | \N\N\N\N |
| \N | \N\N\N\NXXX - ABCDEFGH\N |
| \N | \N\N |
| \N | \N\N\N |
| \N | \N |
+--------+----------------------------------+
We couldn't see that in table above but true format of first string looks like that

Basically, what I would like to retrieve is:
+--------+----------------------------------+
| reason | string |
+--------+----------------------------------+
| \N | XXX - ABCDEFGH |
+--------+----------------------------------+
XXX - remains always the same but ABCDEFGH may be any string. The problem is I can't use table path.path.path_path[4] because string XXX - ABCDEFGH may be 4th or any element of the array (even 20th).
Tried to use where lower(path.path.string) like ('xxx - %') but received error
Select
path.path.reason,
path.path.string
From table_name
Where path.id = '123'
And datestr = '2018-07-21'
SELECT regexp_extract('\N\N\N\NXXX - ABCDEFGH\N\N', '\N\N\N\N(.*?)(\N\N)', 1)