I’m trying to count the number of unique elements in a list (delimiter “,”) in Redshift. I’m currently using REGEXP_COUNT with PCRE patterns for regex. Testing with the below list (“list,test,test,count”), I’d like to get 3 (list, test, count) but it’s resulting in 0.
select REGEXP_COUNT('list,test,test,count', '(w+?b)+(?!.*1b)', 1, 'ip');
The regex portion seems to be working as intended in regex101.com so I don’t understand what’s not working. Super open to options other than REGEXP_COUNT that would work in Redshift as well.