my $string_to_check = "yyy foo-bar doo zzz"; my $set = '[\w-]'; my $b = qr/(?<=$set)(?!$set)|(?