#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\{(?<contents>(([^\{\}|(\r?\n)]*)|(\{[^\{\}|(\r?\n)]*\})|(.*?))*)\}"
Local $sString = "{ int a= 0; arg2, arg3, {arg4}, '{pip' }" & @CRLF & _
"" & @CRLF & _
"void XMLPrinter::PushHeader( bool writeBOM, bool writeDec )" & @CRLF & _
"{" & @CRLF & _
" if ( writeBOM ) {" & @CRLF & _
" static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 };" & @CRLF & _
" Write( reinterpret_cast< const char* >( bom ) );" & @CRLF & _
" }" & @CRLF & _
" if ( writeDec ) {" & @CRLF & _
" PushDeclaration( "xml version=\"1.0\"" );" & @CRLF & _
" }" & @CRLF & _
"}" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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