#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^\[.*+\s*+(?=\[|\z)"
Local $sString = "[PHP]" & @CRLF & _
"engine = On" & @CRLF & _
"short_open_tag = Off" & @CRLF & _
"...." & @CRLF & _
"...." & @CRLF & _
"[CLI Server]" & @CRLF & _
"cli_server.color = On" & @CRLF & _
"[Date]" & @CRLF & _
"[filter]" & @CRLF & _
"[iconv]" & @CRLF & _
"[imap]" & @CRLF & _
"[intl]" & @CRLF & _
"[sqlite3]" & @CRLF & _
"[Pcre]" & @CRLF & _
"[Pdo]" & @CRLF & _
"[Pdo_mysql]" & @CRLF & _
"pdo_mysql.default_socket=" & @CRLF & _
"[Phar]" & @CRLF & _
"[mail function]" & @CRLF & _
"SMTP = localhost" & @CRLF & _
"smtp_port = 25" & @CRLF & _
"mail.add_x_header = Off" & @CRLF & _
"[ODBC]" & @CRLF & _
"...." & @CRLF & _
"...." & @CRLF & _
"[dba]" & @CRLF & _
"[opcache]" & @CRLF & _
"[curl]" & @CRLF & _
"curl.cainfo = "{PHP_Dir_Path}\extras\curl\cacert.pem"" & @CRLF & _
"[openssl]" & @CRLF & _
"[ffi]"
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