my($start, $middle, $end) = split /((?:AB)+)/, $string, 2;