#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?sx)User:\h([^\n]+)\n" & @CRLF & _
"Login\-name:\h([^\n]+)\n" & @CRLF & _
"(?:CaseSensitive:\h([^\n]+)\n)?" & @CRLF & _
"NTSecurity:\h([^\n]+)\n" & @CRLF & _
"(?:NO\n)?" & @CRLF & _
"(?:Domain:\h([^\n]+)\n)?" & @CRLF & _
"Timeout:\h([^\n]+)\n" & @CRLF & _
".*?" & @CRLF & _
"Member:\h([^\n]+)\n"
Local $sString = "User: AMMINISTRATORE" & @CRLF & _
"Login-name: ADM" & @CRLF & _
"CaseSensitive: YES" & @CRLF & _
"NTSecurity: NO" & @CRLF & _
"NO" & @CRLF & _
"Timeout: 00:05:00" & @CRLF & _
"Member: AMMINISTRATORI" & @CRLF & _
"" & @CRLF & _
"User: Test_User" & @CRLF & _
"Login-name: Test_User" & @CRLF & _
"NTSecurity: YES" & @CRLF & _
"Domain: DNEU" & @CRLF & _
"Timeout: 00:00:00" & @CRLF & _
"Member: OPERATORS" & @CRLF & _
"Member: OPERATORS"
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