<?php $text = 'This {is {{Par}m1}} plus {{Par{m3a{{Parm3b}}}} a}nd {{Parm4a||{{Par}m4b||{{Parm4c||{{Parm4d||Parm}}}}}}}}.'; $res = preg_split('~({{(?:(?!{{|}}).|(?1))*}})~', $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); print_r($res);
You have javascript disabled. You will not be able to edit any code.