my( $start, $middle, $end ) = $string =~ m[^ (.*?) ( (?:AB)+ ) (.*?) $]xg