I have a table:
id | string
1 | a,b,c,d,a,b
2 | a,a,c,d,a,b
3 | a,b,c,d
I want to check if letter 'a' repeats in string using regular expressions. How should i do that?
I try with
select * from table where string ~ 'a[^a]*'
but its not working.
Expected result:
id | string | repeat_a
1 | a,b,c,d,a,b | t
2 | a,a,c,d,a,b | t
3 | a,b,c,d | f
'(.*a){2}'pattern, but you should think of a better db normalization, like a joining table instead of multiple values (separated by,) in thestringcolumn