1 2 3 4 5 6
<?php $regex = "#{([^}]*)}(.*?)\{/\\1}#"; $str = '{foo}bar{/foo}'; echo preg_replace($regex, '$2', $str);
1
bar