in reply to regular expressions - finding repeats

     /([ABCD])\1{4}/

Match (and capture with parens) the first character, then match consecutive repeats of whatever character you captured. This is called a backreference, and used to match repeated things. Check out perlre and search for "backreference" for more info.

Update: A backref can also match more than one character. You can match the strings "ABCABC" "ABBABB", "CBCB", "DD" with the following regex:

     /([ABCD]+)\1/

blokhead