in reply to Perl Regex
There are many ways to do this. I would propose a repeated split instead of a regex. First split on ][, then for each of the results split on |, take the fourth element and split that on +. Sounds more complicated than it is:
use strict; use warnings; use Data::Dumper; my $data = '[-3|1|29x250+46+26|200+300+464|Get][-3|1|29x250+46+26|132+ +100+244|come][-3|1|29x250+46+26|220+124+432|Go]'; my @splitted = map { [ split /\+/, (split /\|/)[3] ] } split /]\[/, $ +data; print Dumper \@splitted;
As a result you get
$VAR1 = [ [ '200', '300', '464' ], [ '132', '100', '244' ], [ '220', '124', '432' ] ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Regex
by smls (Friar) on Oct 10, 2013 at 11:41 UTC | |
|
Re^2: Perl Regex
by Buddyhelp (Initiate) on Oct 10, 2013 at 11:21 UTC | |
by Corion (Patriarch) on Oct 10, 2013 at 11:27 UTC | |
by Buddyhelp (Initiate) on Oct 10, 2013 at 11:43 UTC | |
by hdb (Monsignor) on Oct 10, 2013 at 11:43 UTC | |
by Buddyhelp (Initiate) on Oct 10, 2013 at 11:51 UTC |