while ($test =~ /\[img\]([^\[\]]+?)\[\/img\]/g) { print "$1 \n"; }