#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(\/\/ \[\'administrator_start\'\])(.|\n)*(\/\/ \[\'administrator_end\'\])"
Local $sString = " // ['administrator_start']" & @CRLF & _
" if ($_SESSION["user_group_short"] == "administrator" && $_SESSION['active'] == 1) {" & @CRLF & _
"//" & @CRLF & _
"//" & @CRLF & _
"//Группа administrator" & @CRLF & _
"//" & @CRLF & _
"//" & @CRLF & _
" ?>" & @CRLF & _
" <div>" & @CRLF & _
" Администратор" & @CRLF & _
" </div>" & @CRLF & _
" <div id="databoard">" & @CRLF & _
" <?php" & @CRLF & _
"" & @CRLF & _
" function showTree($folder) {" & @CRLF & _
" /* Получаем полный список файлов и каталогов внутри $folder */" & @CRLF & _
" $files = scandir($folder);" & @CRLF & _
" foreach ($files as $file) {" & @CRLF & _
" /* Отбрасываем текущий и родительский каталог */" & @CRLF & _
" if (($file == '.') || ($file == '..')) {" & @CRLF & _
" continue;" & @CRLF & _
" }" & @CRLF & _
" $f0 = $folder . '/' . $file; //Получаем полный путь к файлу" & @CRLF & _
" /* Если это директория */" & @CRLF & _
" if (is_dir($f0)) {" & @CRLF & _
" /* Выводим, делая заданный отступ, название директории */" & @CRLF & _
" echo "<p>" . translate(iconv(mb_detect_encoding($file, mb_detect_order(), true), "UTF-8", $file)) . "</p>";" & @CRLF & _
" /* С помощью рекурсии выводим содержимое полученной директории */" & @CRLF & _
" showTree($f0);" & @CRLF & _
" } else {" & @CRLF & _
" /* Если это файл, то просто выводим название файла */" & @CRLF & _
" $name_page = explode(".", iconv(mb_detect_encoding($file, mb_detect_order(), true), "UTF-8", $file));" & @CRLF & _
" echo "<a style='text-decoration: none;' href='" . iconv(mb_detect_encoding($f0, mb_detect_order(), true), "UTF-8", $f0) . "'>" . translate($name_page[0]) . "</a> ";" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" showTree("../pages/" . $_SESSION['user_group_short']);" & @CRLF & _
" ?>" & @CRLF & _
" </div>" & @CRLF & _
" <?php" & @CRLF & _
" }" & @CRLF & _
"// ['administrator_end']" & @CRLF & _
"// ['insert_body']"
Local $sSubst = ""
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm