#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?<=Total\sDue).*"
Local $sString = " Invoice" & @CRLF & _
"" & @CRLF & _
"From: Invoice Number INV-3337" & @CRLF & _
"DEMO - Sliced Invoices Order Number 12345" & @CRLF & _
"Suite 5A-1204 Invoice Date January 25, 2016" & @CRLF & _
"123 Somewhere Street Due Date January 31, 2016" & @CRLF & _
"Your City AZ 12345 Total Due $93.50" & @CRLF & _
"admin@slicedinvoices.com" & @CRLF & _
"" & @CRLF & _
"To:" & @CRLF & _
" Paid" & @CRLF & _
"Test Business" & @CRLF & _
"123 Somewhere St" & @CRLF & _
"Melbourne, VIC 3000" & @CRLF & _
"test@test.com" & @CRLF & _
"" & @CRLF & _
" Hrs/Qty Service Rate/Price Adjust Sub Total" & @CRLF & _
" 1.00 Web Design $85.00 0.00% $85.00" & @CRLF & _
" This is a sample description..." & @CRLF & _
"" & @CRLF & _
" Sub Total $85.00" & @CRLF & _
" Tax $8.50" & @CRLF & _
" Total $93.50" & @CRLF & _
"" & @CRLF & _
"ANZ Bank" & @CRLF & _
"ACC # 1234 1234" & @CRLF & _
"BSB # 4321 432" & @CRLF & _
"" & @CRLF & _
"Payment is due within 30 days from date of invoice. Late payment is subject to fees of 5% per month." & @CRLF & _
"Thanks for choosing DEMO - Sliced Invoices | admin@slicedinvoices.com" & @CRLF & _
"Page 1/1"
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