<?php
$input = 'sdfsdf sdfsdf fd<%MYSTRING123%>d12df fsdsgsg d';
preg_match_all('/\[<%MYSTRING\](.*?)\[%>\]/', $input, $matches);
var_dump($matches);