rookie_monk has asked for the wisdom of the Perl Monks concerning the following question:
I need it to do something like this:my($text) = "(network)(test)(ifcfg)"; my($first, $second, $third) = $text =~ /\((.*)\)\((.*)\)\((.*)\)/; print "$first and $second and $third\n";
I would also like it to count how many matches it makes because the input could possibly have more or less than 3 matches. Thanks in advance.... -Paulmy($text) = "(network) (test)_(ifcfg)"; my($first, $second, $third) = $text =~ /\((.*)\)/; #have this match all 3 and store them print "$first and $second and $third\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting multiple matches from Reg Ex
by dasgar (Priest) on Sep 01, 2010 at 22:16 UTC | |
by rookie_monk (Novice) on Sep 02, 2010 at 14:22 UTC | |
|
Re: Extracting multiple matches from Reg Ex
by ww (Archbishop) on Sep 01, 2010 at 22:32 UTC | |
|
Re: Extracting multiple matches from Reg Ex
by graff (Chancellor) on Sep 01, 2010 at 23:34 UTC | |
|
Re: Extracting multiple matches from Reg Ex
by johngg (Canon) on Sep 01, 2010 at 23:11 UTC | |
|
Re: Extracting multiple matches from Reg Ex
by aquarium (Curate) on Sep 02, 2010 at 00:53 UTC | |
|
Re: Extracting multiple matches from Reg Ex
by perlpie (Beadle) on Sep 02, 2010 at 00:12 UTC |