more useful options | |
PerlMonks |
Re^2: regex for multiple capture within boundaryby johngg (Canon) |
on Jul 16, 2006 at 22:14 UTC ( [id://561607]=note: print w/replies, xml ) | Need Help?? |
I think I understand what is going on in the first of your updated solutions but if I change it to read
expecting output of
it doesn't work unless I also make the first match global like this
I think this is because the round brackets around the match put the match into list context and the [0] subscript grabs the first elements of the match; however, since the match is non-global there will only ever be one element in the list and trying to get more will not work. If we want a second or subsequent element we must make the match global to capture more than one element. Have I understood this correctly or am I completely missing the point? Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|