my $a = "this is a test [[1]] [[ a ]] [[ abd ]] [[\%object,key]]"; my @x = $a =~ m/(\[\[.*?\]\])/g; print "@x\n";