my %seen; m{\[b\](.*?)\[/b\]} and $seen{$1} = 1 for @array1; my @result = grep {m{\[b\](.*?)\[/b\]} && !$seen{$1}} @array2;