![]() |
|
Welcome to the Monastery | |
PerlMonks |
Variable matching on a regexby LaintalAy (Sexton) |
on Jun 17, 2010 at 09:29 UTC ( #845173=perlquestion: print w/replies, xml ) | Need Help?? |
LaintalAy has asked for the wisdom of the Perl Monks concerning the following question: Dear Monks, I'm on need of wisdom, The problem is that I'm having problems trying to use regexes to retrieve matches that are defined as one/none or more. I'm trying with a simple file as example:
And I was wondering if it's possible to parse and assign them to variables in just one step. The regex I was trying to use was something like
It doesn't work as I'd expect. It matches, but only retrieves the last two elements because instead of getting an array of results for the (?: )+ regex part it stores only the last one. I know a split would work without that much of a hassle but.. shouldn't be possible to do that just with a regex? I've tried different things without success and I haven't found any relevant example of this. Thanks,
Back to
Seekers of Perl Wisdom
|
|