#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)(?<IntKey>[^\s<>{}]+)\s*<(?<IntValue>\d+)>|" & @CRLF & _
"(?<TrueKey>[^\s<>{}]+)\s*<yes>|" & @CRLF & _
"(?<FalseKey>[^\s<>{}]+)\s*<no>|" & @CRLF & _
"(?<StrKey>[^\s<>{}]+)\s*<(?<StrValue>.*?)>|" & @CRLF & _
"(?<ObjectBegin>[^\s<>{}]+)\s*\{|" & @CRLF & _
"(?<ObjectEnd>\})|" & @CRLF & _
"(?<KeyOnly>[^\s<>{}]+)|" & @CRLF & _
"(?<Invalid>\S+)"
Local $sString = "servername {" & @CRLF & _
" store { " & @CRLF & _
" servers {" & @CRLF & _
" * {" & @CRLF & _
" value<>" & @CRLF & _
" port<>" & @CRLF & _
" folder<C:\windows> monitor<yes>" & @CRLF & _
" args<-T -H>" & @CRLF & _
" xrg<store>" & @CRLF & _
" wysargs<-t -g -b>" & @CRLF & _
" accept_any<yes>" & @CRLF & _
" pdu_length<23622>" & @CRLF & _
" }" & @CRLF & _
" test1 {" & @CRLF & _
" name<test1>" & @CRLF & _
" port<123>" & @CRLF & _
" root<c:\test>" & @CRLF & _
" monitor<yes>" & @CRLF & _
" }" & @CRLF & _
" test2 {" & @CRLF & _
" name<test2>" & @CRLF & _
" port<124>" & @CRLF & _
" root<c:\test>" & @CRLF & _
" monitor<yes>" & @CRLF & _
" }" & @CRLF & _
" test3 {" & @CRLF & _
" name<test3>" & @CRLF & _
" port<125>" & @CRLF & _
" root<c:\test>" & @CRLF & _
" monitor<yes>" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
" senders" & @CRLF & _
" timeout<30>" & @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