use strict; use warnings; use 5.10.0; my $string="C*ID1*Mac*C release for EA's D*ID1*Spore1 game*D; D*ID1*Spore 1*D is better than D*ID2*Spore 2 game*D."; my @fields; while ($string =~ /([A-Z])\* # A single capital letter followed by star ID\d+\* # String 'ID' followed by a number and a star .*? # Anything \*\1 # A star followed by the original single capital letter /gx) { push @fields, $&; }