#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?u)Authentication-results:.+?sender IP.+\R?.+?mailfrom=(.+?);"
Local $sString = "Return-path: <JaneSmith@SomeDummyCo.com>" & @CRLF & _
"Received: from ms11p00im-qufv17093501.mac.com ([17.58.36.64])" & @CRLF & _
" by ms24534.mac.com" & @CRLF & _
" (Oracle Communications Messaging Server 8.0.1.3.20170906 64bit (built Sep 6" & @CRLF & _
" 2017)) with ESMTP id <0PE4008Z5RC0PLA0@ms24534.mac.com> for" & @CRLF & _
" JohnDoe@icloud.com; Mon, 27 Aug 2018 17:31:12 +0000 (GMT)" & @CRLF & _
"Original-recipient: rfc822;JohnDoe@icloud.com" & @CRLF & _
"Received: from NAM04-SN1-obe.outbound.protection.outlook.com" & @CRLF & _
" (mail-eopbgr700137.outbound.protection.outlook.com [40.107.70.137])" & @CRLF & _
" by ms11p00im-qufv17093501.me.com" & @CRLF & _
" (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31" & @CRLF & _
" 2018)) with ESMTPS id <0PE400K2IRBZ4F00@ms11p00im-qufv17093501.me.com> for" & @CRLF & _
" JohnDoe@icloud.com (ORCPT JohnDoe@icloud.com); Mon," & @CRLF & _
" 27 Aug 2018 17:31:12 +0000 (GMT)" & @CRLF & _
"X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0" & @CRLF & _
" clxscore=1005 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0" & @CRLF & _
" bulkscore=0 classifier=clx:Deliver adjust=0 reason=mlx scancount=1" & @CRLF & _
" engine=8.0.1-1807170000 definitions=main-1808270184" & @CRLF & _
"X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,," & @CRLF & _
" definitions=2018-08-27_07:,, signatures=0" & @CRLF & _
"Authentication-results: ms11p00im-qufv10093201.me.com; dmarc=none" & @CRLF & _
" header.from=apoemail.us" & @CRLF & _
"Authentication-results: ms11p00im-qufv10113901.me.com; spf=pass" & @CRLF & _
" (ms11p00im-qufv10113901.me.com: domain of JaneSmith@SomeDummyCo.com designates" & @CRLF & _
" 40.107.70.137 as permitted sender) smtp.mailfrom=JaneSmith@SomeDummyCo.com" & @CRLF & _
"Received-SPF: pass (ms11p00im-qufv10113901.me.com: domain of" & @CRLF & _
" JaneSmith@SomeDummyCo.com designates 40.107.70.137 as permitted sender)" & @CRLF & _
" receiver=ms11p00im-qufv10113901.me.com; client-ip=40.107.70.137;" & @CRLF & _
" helo=NAM04-SN1-obe.outbound.protection.outlook.com;" & @CRLF & _
" envelope-from=JaneSmith@SomeDummyCo.com" & @CRLF & _
"Authentication-results: ms11p00im-qufv17063001.me.com; dkim=pass (1024-bit key)" & @CRLF & _
" header.d=NETORGFT744019.onmicrosoft.com" & @CRLF & _
" header.i=@NETORGFT744019.onmicrosoft.com header.b=fYoFciKN" & @CRLF & _
"DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;" & @CRLF & _
" d=NETORGFT744019.onmicrosoft.com; s=selector1-apoemail-us;" & @CRLF & _
" h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;" & @CRLF & _
" bh=ZUfrOM+P5LAWsuKD/Lnb58GuE4orISbImwlBF3a/vyc=;" & @CRLF & _
" b=fYoFciKNtylrXwhibBhDmgiw70cFEaUP4XADRpc2cfX3M/4o94Uc7kMGMdo7wj1KqH/d/ShRSn1YX36qzEnW5yA26XIloXj/bt7iZX2LN5boJlI6OaE6DFUIKivm2Cfvl4Q9wckPQRot76ogx/NeYCwfJvD/OgGybwJWjoLQQJo=" & @CRLF & _
"Received: from DM3PR19MB0521.namprd19.prod.outlook.com (10.164.248.145)" & @CRLF & _
" by DM3PR19MB0825.namprd19.prod.outlook.com (10.166.164.151)" & @CRLF & _
" with Microsoft SMTP Server" & @CRLF & _
" (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384)" & @CRLF & _
" id 15.20.1080.14; Mon, 27 Aug 2018 17:31:09 +0000" & @CRLF & _
"Received: from DM3PR19MB0521.namprd19.prod.outlook.com" & @CRLF & _
" ([fe80::69c8:8da3:dc38:8caa]) by DM3PR19MB0521.namprd19.prod.outlook.com" & @CRLF & _
" ([fe80::69c8:8da3:dc38:8caa%5]) with mapi id 15.20.1080.015; Mon," & @CRLF & _
" 27 Aug 2018 17:31:09 +0000" & @CRLF & _
"From: John Doe <JaneSmith@SomeDummyCo.com>" & @CRLF & _
"To: John Doe <JohnDoe@icloud.com>" & @CRLF & _
"Subject: AutoResponder - Acme Inc - New Client Questionnaire - - Steven" & @CRLF & _
" Plain Text TEST 03/12/1971" & @CRLF & _
"Thread-topic: AutoResponder - Acme Inc - New Client Questionnaire - -" & @CRLF & _
" Steven Plain Text TEST 03/12/1971" & @CRLF & _
"Thread-index: AQHUPiu+8RdF6Tdpg0SO88Zlg/iLzQ==" & @CRLF & _
"Date: Mon, 27 Aug 2018 17:31:09 +0000" & @CRLF & _
"Message-id: <D7A99F58.1E1AA%JaneSmith@SomeDummyCo.com>" & @CRLF & _
"Accept-Language: en-US" & @CRLF & _
"Content-language: en-US" & @CRLF & _
"X-MS-Has-Attach:" & @CRLF & _
"Authentication-results: spf=none (sender IP is )" & @CRLF & _
" smtp.mailfrom=JaneSmith@SomeDummyCo.com;" & @CRLF & _
"X-Originating-IP: [98.195.128.79]" & @CRLF & _
"X-Microsoft-Exchange-Diagnostics:" & @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