I am trying to parse a csv file, and I am trying to access names regex in proto regex in Perl6. It turns out to be Nil. What is the proper way to do it?
gra
The match for
lives within the scope of the capture group, which you get via $m1[0]
.
As the group is quantified with *
, the results will again be a list, ie you need another indexing operation to get at a match object, eg $m1[0][0]
for the first one.
The named capture can then be accessed by name, eg $m1[0][0]
. This will already contain the match result of the appropriate branch of the protoregex.
If you want the whole list of matches instead of a specific one, you can use >>
or map
, eg $m1[0]>>.
.