#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?i)(data)\s+((\w+)(?=(\s*))(?:\4\w+)+)?\s*(\(((.|\n)*?)\);)?"
Local $sString = "data foo (drop = DISCOUNT price RENAME = ( PROV_NM1= PROV_NM PROV_ST_NM1 = PROV_ST_NM) where = ( product = 'whizmo' and product < 10 )) bar( drop= DISCOUNT price rename= ( startDate = beginDate ) );" & @CRLF & _
"" & @CRLF & _
"Data Data_asof&YrMon.;" & @CRLF & _
"" & @CRLF & _
"data halfYear( drop= DISCOUNT price" & @CRLF & _
" rename= ( startDate = beginDate ) where=(product = 'abc' and price > 10) );" & @CRLF & _
"" & @CRLF & _
"data apply_adj_v2 non_adjusted incorrect_acct;" & @CRLF & _
"" & @CRLF & _
"data apply_adj_v2;" & @CRLF & _
"" & @CRLF & _
"DATA INPDTL1(RENAME=(PROV_NM1=PROV_NM PROV_ST_NM1=PROV_ST_NM));" & @CRLF & _
"" & @CRLF & _
"DATA REIMB_MTHD_CLM2;" & @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