In url http://www.php.net/manual/en/function.preg-replace-callback.php I read this example: <?php$input = "plain [indent] deep [indent] deeper [/indent] deep [/indent] plain";function parseTagsRecursive($input){ $regex = '#\[indent]((?:[^[]|\[(?!/?indent])|(?R))+)\[/indent]#'; if (is_array($input)) { $input = '<div style="margin-left: 10px">'.$input[1].'</div>'; } return preg_replace_callback($regex, 'parseTagsRecursive', $input);}$output = parseTagsRecursive($input);echo $output;?> example does not work if there are more deep statement in var I mean if $input = "plain [indent] deep [indent] deeper [/indent] deep [/indent] plain plain [indent] deep [indent] deeper [/indent] deep [/indent] plain "; it does not work corectly how can I solve this problem _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/