my $str = '---BBB--- ..... '; my @bits = split /(B+)/, $str; #### 0: '---' 1: 'BBB' 2:'---'