in reply to Re: Problem with capturing all matches with regex
in thread Problem with capturing all matches with regex

OK, I've abbreviated my problem @ first, but your answer suggested, that I should tell the whole story, as why I didn't use /g, for example.
I've updated my original post.
  • Comment on Re^2: Problem with capturing all matches with regex

Replies are listed 'Best First'.
Re^3: Problem with capturing all matches with regex
by tybalt89 (Monsignor) on Oct 12, 2016 at 15:09 UTC
    #!/usr/bin/perl -l # http://perlmonks.org/?node_id=1173839 use strict; use warnings; my $equation = '979x + 87y - 8723z = 274320'; #my @parts = ($equation =~ /^(?:(.*?)([xyz]))+/i); my @parts = grep defined, $equation =~ /(.*?)([xyz])|(.*?)=(.*)/gi; use Data::Dumper; print Dumper \@parts;