#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)^subject:\s(.+)"
Local $sString = "Received: from DOMAIN.mydomain.com (UnknownHost [127.0.0.1]) by DOMAIN.mydomain.net with SMTP;" & @CRLF & _
" Fri, 6 Sep 2013 10:34:07 -0600" & @CRLF & _
"Date: Fri, 6 Sep 2013 10:34:07 -0600 (MDT)" & @CRLF & _
"From: "MyDomain.com" " & @CRLF & _
"To: test@anotherdomain.com" & @CRLF & _
"Message-ID: <8279725.100.1378485247161.JavaMail.MYDOMAIN$@127.0.0.1>" & @CRLF & _
"Subject: Membership Activation" & @CRLF & _
"MIME-Version: 1.0" & @CRLF & _
"Content-Type: text/html; charset=UTF-8" & @CRLF & _
"Content-Transfer-Encoding: 7bit" & @CRLF & _
"Subject: Membership Activation" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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