my @arr = split /<\/p>/, $string; @matches = grep { /\[tab\]/ } @arr;