How to match repeated characters using regular expression operator =~ in bash?

Viewed 4497

I want to know if a string has repeated letter 6 times or more, using the =~ operator.

a="aaaaaaazxc2"
if [[ $a =~ ([a-z])\1{5,} ]];
then
     echo "repeated characters"
fi

The code above does not work.

3 Answers
Related