#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?ms)^.*?\n\n"
Local $sString = "Subject: RE: Test mail" & @CRLF & _
"From: test@stackoverflow.com" & @CRLF & _
"To: test@test.com" & @CRLF & _
"Date: 22/06/2018 10:00:00" & @CRLF & _
"" & @CRLF & _
"This is the body of e-mail #3." & @CRLF & _
"" & @CRLF & _
"Subject: RE: Test mail" & @CRLF & _
"From: test@test.com" & @CRLF & _
"To: test@stackoverflow.com" & @CRLF & _
"Date: 22/06/2018 09:55:00" & @CRLF & _
"" & @CRLF & _
"This is the body of e-mail #2." & @CRLF & _
"" & @CRLF & _
"Subject: Test mail" & @CRLF & _
"From: test@stackoverflow.com" & @CRLF & _
"To: test@test.com" & @CRLF & _
"Date: 22/06/2018 09:50:00" & @CRLF & _
"" & @CRLF & _
"This is the body of e-mail #1."
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