#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "-{3}.*[\s\S]*?(?=\s*(?:-{3}|$))"
Local $sString = "---Agent 1: Wednesday 08/16/2017 | 11:43 AM ---" & @CRLF & _
"" & @CRLF & _
"Message 1" & @CRLF & _
"" & @CRLF & _
"--- Agent 1: Friday 06/09/2017 | 9:02 AM ---" & @CRLF & _
"" & @CRLF & _
"Message 2" & @CRLF & _
"" & @CRLF & _
"--- Agent 1: Friday 04/14/2017 | 10:35 AM ---" & @CRLF & _
"" & @CRLF & _
"Message 3" & @CRLF & _
"" & @CRLF & _
"--- Agent 1: Monday 02/13/2017 | 12:07 AM ---" & @CRLF & _
"" & @CRLF & _
"This" & @CRLF & _
"" & @CRLF & _
"is" & @CRLF & _
"" & @CRLF & _
"message" & @CRLF & _
"" & @CRLF & _
"3" & @CRLF & _
"" & @CRLF & _
" --- Agent 1: Monday 12/19/2016 | 1:31 PM ---" & @CRLF & _
"" & @CRLF & _
" Message 4 " & @CRLF & _
"" & @CRLF & _
" --- Agent 1: Monday 10/24/2016 | 10:48 AM ---" & @CRLF & _
"" & @CRLF & _
" Message 5"
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