#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(.+\s-\s\w{2})$|^(Total\s\d{1,5}:.+)$"
Local $sString = "Total" & @CRLF & _
"2015" & @CRLF & _
"DOLLAR" & @CRLF & _
"AMOUNT" & @CRLF & _
"Oct-15 DIFF 15-16" & @CRLF & _
"Total" & @CRLF & _
"2015" & @CRLF & _
"COMPANY 1 - WI" & @CRLF & _
"Nuts $ 59.85 $ 0.00 $ 135.45 $ 0.00 $ 135.45 $0.00" & @CRLF & _
"Bolts $ 0.00 $ 0.00 $ 0.00 $ 0.00 $ 0.00 $0.00" & @CRLF & _
"Screws $ 449.20 $ 0.00 $ 541.23 $ 0.00 $ 541.23 $0.00" & @CRLF & _
"Total 7765: $ 509.05 $ 0.00 $ 676.68 $ 0.00 $ 676.68 $0.00" & @CRLF & _
"Company 2 - NE" & @CRLF & _
"Nuts $ 0.00 $ 0.00 $ 0.00 $ 0.00 $ 0.00 $0.00" & @CRLF & _
"Bolts $ 0.00 $ 55.67 $ 542.48 $ 719.82 $(177.34) $777.02" & @CRLF & _
"Total 1876: $ 0.00 $ 55.67 $ 2,960.52 $ 4,265.82 $(1,305.30) $5,854.60" & @CRLF & _
"Company 3 - MN" & @CRLF & _
"Nuts $ 109.52 $ 606.52 $ 858.36 $ 606.52 $ 251.84 $606.52" & @CRLF & _
"Paper $ 0.00 $ 0.00 $ 483.82 $ 0.00 $ 483.82 $678.30" & @CRLF & _
"Gas $ 0.00 $ 0.00 $ 0.00 $ 0.00 $ 0.00 $0.00" & @CRLF & _
"OTHER $ 521.49 $ 0.00 $ 521.49 $ 0.00 $ 521.49 $0.00" & @CRLF & _
"Total 6524: $ 631.01 $ 606.52 $ 3,909.09 $ 606.52 $ 3,302.57 $1,284.82" & @CRLF & _
"Company 4 - IA" & @CRLF & _
"Anything $ 0.00 $ 0.00 $ 0.00 $ 0.00 $ 0.00 $0.00" & @CRLF & _
"Other $ 0.00 $ 0.00 $ 171.90 $ 0.00 $ 171.90 $0.00" & @CRLF & _
"Total 1123: $ 0.00 $ 0.00 $ 171.90 $ 0.00 $ 171.90 $0.00"
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