$file = '{include file="{$COMMON_TPL_PATH}common/header_admin.tpl"}
{include file="{$mainPage}"}
{include file="{$COMMON_TPL_PATH}common/footer_admin.tpl"}';
preg_match('/^(\{\})|^(\{\*([\S\s]*?)\*\})|^(<\?(?:php\w+|=|[a-zA-Z]+)?)|^([ ]*[
]+[ ]*)|^(\{strip\})|^(\{\/strip\})|^(\{literal\})|^(\{\s{1,}\/)|^(\{\s{1,})|^(\{\/)|^(\{)|^(([\S\s]*?)(?=([ ]*[
]+[ ]*|\{|<\?)))|^([\S\s]+)/', $file, $matches);
var_dump($matches);
Neden çıktı:
array(13) {
[0]=>
string(1) "{"
[1]=>
string(0) ""
[2]=>
string(0) ""
[3]=>
string(0) ""
[4]=>
string(0) ""
[5]=>
string(0) ""
[6]=>
string(0) ""
[7]=>
string(0) ""
[8]=>
string(0) ""
[9]=>
string(0) ""
[10]=>
string(0) ""
[11]=>
string(0) ""
[12]=>
string(1) "{"
}
Bu ^([\S\s]+)
bütün dize maç gibi geliyor bana ..