my $regex = sub { qr/@_/ }->( join '|', map {quotemeta} sort { length $b <=> length $a } @values); print "$regex\n";