#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(^\w{3}\s+\d+\s\d+:\d+:\d+)\s?:\s?(\w+?)\s+:.*"
Local $sString = "Aug 7 14:14:43 : user1 : TTY=pts/53 ; PWD=/path2 ;" & @CRLF & _
" USER=root ; COMMAND=/path/to/cmd1" & @CRLF & _
"Aug 7 14:14:49 : user2 : TTY=pts/53 ; PWD=/usr/home ;" & @CRLF & _
" USER=root ; COMMAND=./myscript.sh -m name -o SCHEDULER" & @CRLF & _
"Aug 7 14:15:14 : user3 : TTY=pts/34 ;" & @CRLF & _
" PWD=/path ; USER=root ;" & @CRLF & _
" COMMAND=/usr/bin/egrep ^[a-z]*" & @CRLF & _
" /filename/toto1234" & @CRLF & _
"Aug 7 14:15:37 : user4 : TTY=unknown ; PWD=/opt/nagios ; USER=root ;" & @CRLF & _
" COMMAND=/path/to/less" & @CRLF & _
" /var/opt/otherfile" & @CRLF & _
"Aug 7 14:16:04 : user4 : TTY=pts/34 ;" & @CRLF & _
" PWD=/usr/local/bin/script ; USER=root ;" & @CRLF & _
" COMMAND=/usr/bin/egrep ^[a-z]*" & @CRLF & _
" /user/local/sbin/tata" & @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