#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\b[\w-]+(?:\.[\w-]+){2,}\b"
Local $sString = "Received: by with SMTP id gx4so163592215ieb.1" & @CRLF & _
" for mail-ie0-x247.google.com <myemailaddress@gmail.com>; Mon, 01 Jun mail-ie0-x247.google.com 2015 18:34:50 -0700 (PDT)" & @CRLF & _
"" & @CRLF & _
"max.google.com" & @CRLF & _
"Received: from localhost (localhost.localdomain [127.0.0.1])" & @CRLF & _
"by mail.server.com (Postfix) with ESMTP id 822B1190A4AF" & @CRLF & _
"for <alex@example.com>; Tue, 17 Feb 2015 13:13:54 +0000 (UTC)" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Received: from [x.x.x.x] by mail.kampl.com (Cipher TLSv1.2:AES-SHA:128) (MDaemon PRO v15.0.1)" & @CRLF & _
"" & @CRLF & _
"b-app05-06.boldchat.com" & @CRLF & _
"ns126a.ba1.enops.net" & @CRLF & _
"ms-out.evernote.com " & @CRLF & _
"obeml1.aerlingus.com" & @CRLF & _
"NHQSDFEXCHUB01.nam.coair.com" & @CRLF & _
"ncsmcexchub01.nam.coair.com" & @CRLF & _
"o1.em.thetaoofbadass.com" & @CRLF & _
"" & @CRLF & _
"b-app05-06.boldchat.com" & @CRLF & _
"ns126a.ba1.enops.net" & @CRLF & _
"NHQSDFEXCHUB01.nam.coair.com" & @CRLF & _
"ncsmcexchub01.nam.coair.com" & @CRLF & _
"" & @CRLF & _
"mta2l1.trans.r.grouponmail.co.uk" & @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