You can split the string to rows with regexp_split_to_table()
in a lateral join, then aggregate:
select x.val, count(*) cnt
from mytable t
cross join lateral regexp_split_to_table(t.mycol, '\s/\s') as x(val)
group by x.val
val | cnt :---- | --: bar | 2 foo | 3 hello | 2
CLICK HERE to find out more related problems solutions.