in reply to Problem with capturing all matches with regex
I changed 3 things:
use warnings; use strict; use Data::Dumper; my $equation = '979x + 87y - 8723z = 274320'; my @parts = ($equation =~ /(?:(.*?)([xyz]))/ig); print Dumper(\@parts); __END__ $VAR1 = [ '979', 'x', ' + 87', 'y', ' - 8723', 'z' ];
Tip #9 from the Basic debugging checklist ... YAPE::Regex::Explain
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with capturing all matches with regex
by igoryonya (Pilgrim) on Oct 12, 2016 at 14:44 UTC | |
by tybalt89 (Monsignor) on Oct 12, 2016 at 15:09 UTC |