#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)^(.*?)(?=On\s+\d{2}\-\d+\-\d+|\#{2}\-.*?\-\#{2})"
Local $sString = "Second reply. #2" & @CRLF & _
"" & @CRLF & _
"Met vriendelijke groet," & @CRLF & _
"{sender name}" & @CRLF & _
"" & @CRLF & _
"{company details}" & @CRLF & _
"" & @CRLF & _
"On 25-02-15 14:38, {email name} wrote:" & @CRLF & _
"> [Ticket ID: 54e70396110971424425] Re: 54e70396110,678567.971424425" & @CRLF & _
">" & @CRLF & _
"> ##- Please type your reply above this line -##" & @CRLF & _
">" & @CRLF & _
"> Your request (54e70396110971424425) has been deemed solved. To reopen, " & @CRLF & _
"> please reply to this email or login on {name} to reply." & @CRLF & _
">" & @CRLF & _
"> ------------------------------------------------------------------------" & @CRLF & _
">" & @CRLF & _
"> Feb 25, 14:38" & @CRLF & _
">" & @CRLF & _
"> Dear Test user," & @CRLF & _
">" & @CRLF & _
"> First reply. #1" & @CRLF & _
">" & @CRLF & _
">" & @CRLF & _
"> {name}" & @CRLF & _
"> {company details}" & @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