ravi45722 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying this regex. But not reached. Help me in solving this
my $str = <<EO_STR; must-column08:Submit & must-column10:Delivered must-column08:Submit & must-column10:Delivered One & must-column9:No_e +rror must-column08:See Here & must-column10:Delivered | must-column9:No_err +or EO_STR my @array = *some_regex*; foreach my $element (@array) { print "$element\n"; } Needed output: must-column08:Submit & must-column10:Delivered must-column08:Submit & must-column10:Delivered One & must-column9:No_error must-column08:See Here & must-column10:Delivered | must-column9:No_error
My trails :
my @matches = $str =~ /(\w+)-(\w+|[0-9]+):(\w+|[0-9]+)\s[&|\|](\w+)-(\w+|[0-9]+):(\w+|[0-9]+)\s[&|\|]/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex : Return match elements
by choroba (Cardinal) on Jun 24, 2016 at 12:16 UTC | |
by ravi45722 (Pilgrim) on Jun 24, 2016 at 13:22 UTC | |
by Marshall (Canon) on Jun 24, 2016 at 14:45 UTC | |
|
Re: Regex : Return match elements
by AnomalousMonk (Archbishop) on Jun 24, 2016 at 15:52 UTC | |
by ravi45722 (Pilgrim) on Oct 25, 2016 at 10:15 UTC | |
by AnomalousMonk (Archbishop) on Oct 25, 2016 at 17:07 UTC | |
|
Re: Regex : Return match elements
by AnomalousMonk (Archbishop) on Jun 24, 2016 at 17:30 UTC |