#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)EventCode\s*=\s*4625|Caller Process Name.*svchost.exe"
Local $sString = "02/11/2020 11:51:38 AM" & @CRLF & _
"LogName=Security" & @CRLF & _
"SourceName=Microsoft Windows security auditing." & @CRLF & _
"EventCode=4625" & @CRLF & _
"EventType=0" & @CRLF & _
"Type=Information" & @CRLF & _
"ComputerName=MelissaNBT3RG22" & @CRLF & _
"TaskCategory=Logon" & @CRLF & _
"OpCode=Info" & @CRLF & _
"RecordNumber=40702" & @CRLF & _
"Keywords=Audit Failure" & @CRLF & _
"Message=An account failed to log on." & @CRLF & _
"" & @CRLF & _
"Subject:" & @CRLF & _
" Security ID: S-1-5-18" & @CRLF & _
" Account Name: MELISSANBT3RG22$" & @CRLF & _
" Account Domain: WORKGROUP" & @CRLF & _
" Logon ID: 0x3E7" & @CRLF & _
"" & @CRLF & _
"Logon Type: 2" & @CRLF & _
"" & @CRLF & _
"Account For Which Logon Failed:" & @CRLF & _
" Security ID: S-1-0-0" & @CRLF & _
" Account Name: MNesavich" & @CRLF & _
" Account Domain: MELISSANBT3RG22" & @CRLF & _
"" & @CRLF & _
"Failure Information:" & @CRLF & _
" Failure Reason: Unknown user name or bad password." & @CRLF & _
" Status: 0xC000006D" & @CRLF & _
" Sub Status: 0xC000006A" & @CRLF & _
"" & @CRLF & _
"Process Information:" & @CRLF & _
" Caller Process ID: 0x848" & @CRLF & _
" Caller Process Name: C:\Windows\System32\svchost.exe" & @CRLF & _
"" & @CRLF & _
"Network Information:" & @CRLF & _
" Workstation Name: MELISSANBT3RG22" & @CRLF & _
" Source Network Address: 127.0.0.1" & @CRLF & _
" Source Port: 0" & @CRLF & _
"" & @CRLF & _
"Detailed Authentication Information:" & @CRLF & _
" Logon Process: User32 " & @CRLF & _
" Authentication Package: Negotiate" & @CRLF & _
" Transited Services: -" & @CRLF & _
" Package Name (NTLM only): -" & @CRLF & _
" Key Length: 0" & @CRLF & _
"" & @CRLF & _
"This event is generated when a logon request fails. It is generated on the computer where access was attempted." & @CRLF & _
"" & @CRLF & _
"The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe." & @CRLF & _
"" & @CRLF & _
"The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network)." & @CRLF & _
"" & @CRLF & _
"The Process Information fields indicate which account and process on the system requested the logon." & @CRLF & _
"" & @CRLF & _
"The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases." & @CRLF & _
"" & @CRLF & _
"The authentication information fields provide detailed information about this specific logon request." & @CRLF & _
" - Transited services indicate which intermediate services have participated in this logon request." & @CRLF & _
" - Package name indicates which sub-protocol was used among the NTLM protocols." & @CRLF & _
" - Key length indicates the length of the generated session key. This will be 0 if no session key was requested."
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