#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(from|to|cc|bcc):.*(?:\R(?!(?:(?1)|$)).*)*"
Local $sString = "From support@test.co.uk Wed Nov 20 15:48:00 2013" & @CRLF & _
"Return-Path: <support@test.co.uk>" & @CRLF & _
"X-Original-To: mailbox@my.domain.com" & @CRLF & _
"Delivered-To: mailbox@my.domain.com" & @CRLF & _
"Delivered-To: techinfo@test.co.uk" & @CRLF & _
"from: "Lucy 1" <support@lucky1.co.uk>,"Lucy 2" <support@lucky2.co.uk>," & @CRLF & _
""Lucy 3" <support@lucky3.co.uk>" & @CRLF & _
"to: TestTo <techinfo@test.co.uk>" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"testestest" & @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