in reply to List::MoreUtils before, after and ... between?
DB<152> @list= ("a".."c","DBIC","A".."C","DANCER","a".."c") => ("a", "b", "c", "DBIC", "A", "B", "C", "DANCER", "a", "b", "c") DB<153> $list = join "\0", @list => "a\0b\0c\0DBIC\0A\0B\0C\0DANCER\0a\0b\0c" DB<154> ($match)= $list =~ /DBIC\0(.*)\0DANCER/ => "A\0B\0C" DB<155> split /\0/,$match => ("A", "B", "C")
this will find the longest interval between the first DBIC and the last Dancer and you are free to use more powerful regexes.
UPDATE: hmm maybe newlines are here a better choice as delimiter.
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: List::MoreUtils before, after and ... between? (1 regex)
by tye (Sage) on Feb 22, 2012 at 07:34 UTC | |
by LanX (Saint) on Feb 22, 2012 at 15:34 UTC | |
by tye (Sage) on Feb 22, 2012 at 16:04 UTC | |
by LanX (Saint) on Feb 22, 2012 at 16:11 UTC | |
by LanX (Saint) on Feb 22, 2012 at 15:58 UTC | |
|
Re^2: List::MoreUtils before, after and ... between?
by Boldra (Curate) on Feb 22, 2012 at 09:08 UTC |