#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m).*\: Service \[ssmtp\] accepted connection from ::ffff:\d+\.\d+\.\d+\.\d+:\d+\n.* s_connect: connect ::1:25: Connection refused \(61\)"
Local $sString = "2019.04.12 10:16:22 LOG5[4]: Service [ssmtp] accepted connection from ::ffff:185.222.209.224:24846" & @CRLF & _
"2019.04.12 10:16:22 LOG3[4]: s_connect: connect ::1:25: Connection refused (61)" & @CRLF & _
"2019.04.12 10:16:22 LOG5[4]: s_connect: connected 127.0.0.1:25" & @CRLF & _
"2019.04.12 10:16:22 LOG5[4]: Service [ssmtp] connected remote server from 127.0.0.1:54674" & @CRLF & _
"2019.04.12 10:16:30 LOG5[3]: Connection closed: 232 byte(s) sent to TLS, 84 byte(s) sent to socket" & @CRLF & _
"2019.04.12 10:16:30 LOG5[5]: Service [ssmtp] accepted connection from ::ffff:193.57.40.242:62532" & @CRLF & _
"2019.04.12 10:16:31 LOG3[5]: s_connect: connect ::1:25: Connection refused (61)" & @CRLF & _
"2019.04.12 10:16:31 LOG5[5]: s_connect: connected 127.0.0.1:25" & @CRLF & _
"2019.04.12 10:16:31 LOG5[5]: Service [ssmtp] connected remote server from 127.0.0.1:54681" & @CRLF & _
"2019.04.12 10:16:31 LOG5[4]: Connection closed: 232 byte(s) sent to TLS, 70 byte(s) sent to socket" & @CRLF & _
"2019.04.12 10:16:42 LOG5[5]: Connection closed: 190 byte(s) sent to TLS, 34 byte(s) sent to socket" & @CRLF & _
"2019.04.12 10:16:43 LOG5[6]: Service [ssmtp] accepted connection from ::ffff:193.57.40.242:13878" & @CRLF & _
"2019.04.12 10:16:45 LOG3[6]: s_connect: connect ::1:25: Connection refused (61)" & @CRLF & _
"2019.04.12 10:16:45 LOG5[6]: s_connect: connected 127.0.0.1:25" & @CRLF & _
"2019.04.12 10:16:45 LOG5[6]: Service [ssmtp] connected remote server from 127.0.0.1:54688" & @CRLF & _
"2019.04.12 10:16:49 LOG5[6]: Connection closed: 232 byte(s) sent to TLS, 68 byte(s) sent to socket"
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