#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)^(?=.* ABN \d{2}(?: \d{3}){3}\n(?P<products>.*\n)Qty\n).*\n\$\d+\.\d{2}\n(?P<subtotal>\d+) +SUBTOTAL\.*\nTOTAL\n\$(?P<total>\d+\.\d{2})\n"
Local $sString = "ㅎㅎ" & @CRLF & _
"Fresh Food" & @CRLF & _
"The fresh food people" & @CRLF & _
"5619 Lorem PH: 00 0000 0000" & @CRLF & _
"204 Some Road" & @CRLF & _
"TAX INVOICE - ABN 88 000 014 675" & @CRLF & _
"Gift Card Visa Varbl 20to500Dollars" & @CRLF & _
"Potato White Washed 2Kg" & @CRLF & _
"Nescafe Coffee Blend 43 50g" & @CRLF & _
"^HToblerone Milk Chocolate Bar 50g" & @CRLF & _
"^HOreo Cookie Original 133g" & @CRLF & _
"#M&Ms Crispy 145g" & @CRLF & _
"*HRed Rock Deli Portgse Chicken 150g" & @CRLF & _
"^HWrigleys Extra Pepprmint 14pc 27g(?.*" & @CRLF & _
"Qty" & @CRLF & _
"57.95" & @CRLF & _
"3.50" & @CRLF & _
"5.00" & @CRLF & _
"0.90" & @CRLF & _
"1.50" & @CRLF & _
"4.50" & @CRLF & _
"3.50" & @CRLF & _
"2 @ $1.80" & @CRLF & _
"each" & @CRLF & _
"3.60" & @CRLF & _
"$80.45" & @CRLF & _
"9 SUBTOTAL" & @CRLF & _
"TOTAL" & @CRLF & _
"$80.45" & @CRLF & _
"REWARDS SAVINGS" & @CRLF & _
"$10.00" & @CRLF & _
"Fresh Food" & @CRLF & _
"5619" & @CRLF & _
"Lorem"
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