while ($string =~ /\[\[[(.*?)\]]\]/ig) { print "The pattern I care about is \"$1\"\n"; }