#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?P<field>^[\w-]+): *(?P<value>[\s\S]+?)(?=^[\w-]+: *|\Z)"
Local $sString = "Message-ID: <1608636066635.7f830.79689714@crcvmail15.nm>" & @CRLF & _
"Received: from 125.209.x.x (net58.219.x-x.host.lt-nn.net [91.219.x.x])" & @CRLF & _
" by crcvmail15.google.com with ESMTP id +844Q-zuS122aEqk5CZDZg" & @CRLF & _
" for <test@google.com>;" & @CRLF & _
"Received: from 125.209.x.x (net58.219.x-18.host.lt-nn.net [91.219.x.x])" & @CRLF & _
" by crcvmail15.google.com with ESMTP id +844Q-zuS122aEqk5CZDZg" & @CRLF & _
" for <test@google.com>;" & @CRLF & _
" Tue, 22 Dec 2020 11:20:58 -0000" & @CRLF & _
"From: "test"<from@google.com>" & @CRLF & _
"To: test@google.com" & @CRLF & _
"Subject:example email" & @CRLF & _
"Content-Type: text/html; charset="utf-8"" & @CRLF & _
"Content-Transfer-Encoding: quoted-printable"
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