in reply to regexp everything except
If you're removing so much of the data from the string, why not bin it and make a new one. Something like:-
my @out = (); while( m/(book|cover)/g ) { push(@out, $1); } my $newstr = join(" ", @out); [download]