http://www.perlmonks.org?node_id=571810


in reply to Text::Balanced with nested / custom brackets

As far as I can tell, Text::Balanced deals with single-character delimiters, whereas your delimiter has two. You might have to resort to using a regexp.
my $extractor; # Must be a seperate statement. $extractor = qr/ \[\[ (?: (?: (?! \[\[ | \]\] ) . )+ | (??{ $extractor }) )+ \]\] /x; my @links = $text =~ /$extractor/g;

Optimized (I think):

my $extractor; # Must be a seperate statement. $extractor = qr/ \[\[ (?> (?: (?: (?> [^\[\]]+ ) | \[ (?! \[ ) | \] (?! \] ) ) | (??{ $extractor }) )+ ) \]\] /x; my @links = $text =~ /$extractor/g;

Tested.