>perl -wMstrict -le "my $s = 'abcxyzdef'; my $exclude = qr{ xyz }xms; my $all_not_xyz = qr{ (?! $exclude) . }xms; my @matches = $s =~ m{ ($all_not_xyz+) }xmsg; print qq{@matches}; " abc yzdef