http://qs321.pair.com?node_id=256400


in reply to Regular Expression Pieces

Because you only have one pair of parentheses, you'll only get $1 defined. A way that you can catch all your matches would be something like this:

my @matches = ($a =~ m/(\[\[.*?\]\])/g);
Then the array @matches will contain all of the matches and you can step through them if you want by using indices to access @matches. Please note to use the /g modifier at the end of the regex to find every possible match.

kelan


Perl6 Grammar Student