I'm trying to remove consecutive numbers from a string in Redshift.
From '16,16,16,3,3,4,16,16,'
I want to get '16,3,4,16,'
.
The following construction doesn't work for me:
SELECT regexp_replace('16,16,16,3,3,4,16,16,', '(.+)\1{1,}', '\1');
It's returning exactly the same string. :(
Thanks!
Here you go.
Here is the answer using a Redshift python UDF.
This returns '16,3,4,16,'