#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)User Name: (?<User_Name>[^ \n]+)"
Local $sString = "LogName=Application" & @CRLF & _
"EventCode=1004" & @CRLF & _
"EventType=4" & @CRLF & _
"ComputerName=Test.local" & @CRLF & _
"User=NOT_TRANSLATED" & @CRLF & _
"Sid=S-1-5-21-2704069758-3089908202-2921546158-1104" & @CRLF & _
"SidType=0" & @CRLF & _
"SourceName=RoxioBurn" & @CRLF & _
"Type=Information" & @CRLF & _
"RecordNumber=16834" & @CRLF & _
"Keywords=Classic" & @CRLF & _
"TaskCategory=Optical Disc" & @CRLF & _
"OpCode=Info" & @CRLF & _
"Message=Date: Wed Feb 28 14:22:59 2024" & @CRLF & _
" Computer Name: COM-HV01" & @CRLF & _
" User Name: Test\test.user" & @CRLF & _
" Writing is completed on drive (E:). Project includes 0 folder(s) and 1 file(s)." & @CRLF & _
" Volume Label: 2024-02-28 " & @CRLF & _
" Volume SN: 0" & @CRLF & _
" Volume ID: \??\Volume{b282bf1c-3dde-11ed-b48e-806e6f6e6963}" & @CRLF & _
" Type: Unknown" & @CRLF & _
" Status Of Media: Appendable,Blank,Closed session" & @CRLF & _
" Files: C:\ProgramData\Roxio Log Files\Test.test.user_20240228142142.txt SHA1: 7c347a6724dcd243d396f9bb5e560142f26b8aa4" & @CRLF & _
" File System: None" & @CRLF & _
" Disc Number: 1" & @CRLF & _
" Encryption: Yes" & @CRLF & _
" User Password: Yes" & @CRLF & _
" Spanned Set: No" & @CRLF & _
" Data Size On Disc Set: 511 Bytes" & @CRLF & _
" Network Volume: No"
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