#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)USER \((\w+)\)$"
Local $sString = "Jul 6 14:01:23 computer.name CRON[29440]: USER (good_user)" & @CRLF & _
"show_time_of_pid("Jul 6 14:02:08 computer.name jam_tag=psim[29187]: (UUID:006)" & @CRLF & _
"Jul 6 14:02:09 computer.name jam_tag=psim[29187]: (UUID:007)" & @CRLF & _
"Jul 6 14:03:01 computer.name CRON[29440]: USER (naughty_user)" & @CRLF & _
"Jul 6 14:03:40 computer.name cacheclient[29807]: start syncing from \"0xDEADBEEF\"" & @CRLF & _
"Jul 6 14:04:01 computer.name CRON[29440]: USER (naughty_user)" & @CRLF & _
"Jul 6 14:05:01 computer.name CRON[29440]: USER (naughty_user)"
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