#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)(On\s.*<\n){0,1}(.*\n(\n){0,1}((^>+\s?.*$)+\n?)+)"
Local $sString = "test comment reply in email" & @CRLF & _
"" & @CRLF & _
"On 10.05.2016 16:06, MRKTNG wrote:" & @CRLF & _
"> New Message" & @CRLF & _
"> MRKTNG <#> " & @CRLF & _
">" & @CRLF & _
"> Your Profile Picture" & @CRLF & _
">" & @CRLF & _
"> Lisa Radzishevsky <#>" & @CRLF & _
"> May 10, 2016, 8:06 am" & @CRLF & _
">" & @CRLF & _
"> " & @CRLF & _
">" & @CRLF & _
"> " & @CRLF & _
">" & @CRLF & _
"> RE: Language learning" & @CRLF & _
">" & @CRLF & _
"> test subject" & @CRLF & _
">" & @CRLF & _
"> " & @CRLF & _
"> Reply " & @CRLF & _
"> <http://mandrillapp.com/track/click/30047086/vendori.local?p=eyJzIjoiLXVwS2lWRndOUXVibWozbmFVQ09qbVE3ZVdjIiwidiI6MSwicCI6IntcInVcIjozMDA0NzA4NixcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvdmVuZG9yaS5sb2NhbFxcXC9kb2N1bWVudFxcXC80ODEwNCNkaXNjdXNzaW9uXCIsXCJpZFwiOlwiY2YwYWFhNWE1ZWY5NDZmMDhlNjJmNmRiMTAyZDY4Y2VcIixcInVybF9pZHNcIjpbXCJhYzE1OWI2NTM2YTM0ZDkzYmU1MzE5Y2VmN2IzOWEwZGQzMjY2NWRkXCJdfSJ9> " & @CRLF & _
">" & @CRLF & _
">" & @CRLF & _
"> © 2015 MRKTNG. All Rights Reserved." & @CRLF & _
"> 1 W Superior St. • Chicago • IL 60654 USA <#>" & @CRLF & _
">" & @CRLF & _
"" & @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