#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?<=Due Date )\d{2}.[A-Z]{3}.\d{4}|(?<=Terms )(\S.+)|(?<=Terms\n\n\d{2}.[A-Z]{3}.\d{4}.)(\d{2}.[A-Z]{3}.\d{4})|(?<=Terms\n\n\d{2}.[A-Z]{3}.\d{4}.\d{2}.[A-Z]{3}.\d{4}.)(\S.+)|(?<=\d{2}.[A-Z]{3}.\d{4}.)(\d{2}.[A-Z]{3}.\d{4}.)|(?<=\d{2}.[A-Z]{3}.\d{4}.\d{2}.[A-Z]{3}.\d{4}.)(\S.+)"
Local $sString = "Invoice Number Invoice Date Due Date Terms" & @CRLF & _
"" & @CRLF & _
"Remit To 100 USD Remit To 200" & @CRLF & _
"" & @CRLF & _
"XI 3849 30 MAR 2017 29 APR 2017 Within 30 days Due net" & @CRLF & _
"" & @CRLF & _
"Sample 2)" & @CRLF & _
"" & @CRLF & _
"Due Date 30 SEP 2017" & @CRLF & _
"Terms Within 30 days Due net" & @CRLF & _
"" & @CRLF & _
"Sample 3)" & @CRLF & _
"" & @CRLF & _
"Invoice Date Due Date Terms" & @CRLF & _
"" & @CRLF & _
"30 MAR 2018 29 APR 2018 Not more than 30 days"
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