http://www.perlmonks.org?node_id=11104712


in reply to minimal superstrings/maximal substrings

Something like this?

c:\@Work\Perl\monks>perl -wMstrict -le "my @lexi_short = qw(numeric sociobio social); ;; my ($rx_lexi_short) = map qr{ (?i) \A (?: $_) .+ }xms, join ' | ', map quotemeta, reverse sort @lexi_short ; ;; printf '%s ', $_ for grep /$rx_lexi_short/, qw(socialist sociobiologist numerical NUMERICIST), qw(social antisocial numeric bio cia) ; " socialist sociobiologist numerical NUMERICIST
See haukex's Building Regex Alternations Dynamically.

Update: For future reference, please see also Short, Self-Contained, Correct Example and How to ask better questions using Test::More and sample data (and maybe I know what I mean. Why don't you?).


Give a man a fish:  <%-{-{-{-<