#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mx)\+\/\-[\s\S]+?//[\s\S]+?(^\};\s+$)"
Local $sString = "block "block1"" & @CRLF & _
"{" & @CRLF & _
"ADDSFDJF" & @CRLF & _
"SDFSDFSDF" & @CRLF & _
"SDFSDFSDF" & @CRLF & _
"" & @CRLF & _
" // subblock: subblock1 [master]" & @CRLF & _
" include "/path/tofile/subblock1.conf";" & @CRLF & _
"+/- subblock subblock1" & @CRLF & _
"// subblock: subblock1" & @CRLF & _
"subblock "subblock1"" & @CRLF & _
"{" & @CRLF & _
" type TYPE;" & @CRLF & _
" file "name.file";" & @CRLF & _
" details blah blah." & @CRLF & _
" other {sdhsdf};" & @CRLF & _
" };" & @CRLF & _
"};" & @CRLF & _
"" & @CRLF & _
" file "dddd.file";" & @CRLF & _
" details blah blah." & @CRLF & _
"" & @CRLF & _
" // subblock: subblock2" & @CRLF & _
" include "/path/tofile/subblock2.conf";" & @CRLF & _
"+/- subblock subblock2" & @CRLF & _
"// subblock: subblock2" & @CRLF & _
"subblock "subblock2"" & @CRLF & _
"{" & @CRLF & _
" type TYPE;" & @CRLF & _
" file "name.file";" & @CRLF & _
" details blah blah." & @CRLF & _
" other {sdhsdf};" & @CRLF & _
" more fields" & @CRLF & _
"};" & @CRLF & _
"};"
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