#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)^(?=.*\bsubject\b)(?=.([\s\S]*)urgent)(?=.([\s\S]*)yahoo\.com).*$"
Local $sString = "User-Agent: Microsoft-MacOutlook/10.17.1.190326" & @CRLF & _
"Date: Wed, 05 Jun 2019 15:04:21 +0800" & @CRLF & _
"Subject: FW: DR OKE DANLDAI PLEASEURGENT" & @CRLF & _
"From: Dennis Chng <Dennischng@r-logic.com>" & @CRLF & _
"To: helpdesk <helpdesk@iqon-asia.com>," & @CRLF & _
" Raynor Tan <raynor@iqon-asia.com>" & @CRLF & _
"Message-ID: <IQON.6059aba563.EF09158E-9BED-4A49-AE31-6851E971014F@r-logic.com>" & @CRLF & _
"Thread-Topic: DR OKE DANLDAI PLEASE URGENT" & @CRLF & _
"References: <341174902.187389.1559716703368.ref@mail.yahoo.com>" & @CRLF & _
" <341174902.187389.1559716703368@mail.yahoo.com>" & @CRLF & _
"In-Reply-To: <341174902.187389.1559716703368@mail.yahoo.com>" & @CRLF & _
"Mime-version: 1.0"
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