my $regex = qr- \[% \s* loop \s* \$ (\S+?) \s* %\] (.*?) \[% \s* end \s* %\]-xms;