#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(\([A-Z]+\)[^$]*\$[^$]*\$[,\d]+)((?:\n(?!.*\([A-Z]+\)[^$]*\$[^$]*\$[,\d]|D:).*)*\nD:.*)?"
Local $sString = "JT Meta Platforms, Inc. - Class A" & @CRLF & _
"Common Stock (META) [ST]S (partial) 02/08/2024 03/05/2024 $1,001 - $15,000" & @CRLF & _
"F S: New" & @CRLF & _
"S O: Morgan Stanley - Select UMA Account # 1" & @CRLF & _
"JT Microsoft Corporation - Common" & @CRLF & _
"Stock (MSFT) [ST]S (partial) 02/08/2024 03/05/2024 $1,001 - $15,000" & @CRLF & _
"F S: New" & @CRLF & _
"S O: Morgan Stanley - Select UMA Account # 1" & @CRLF & _
"JT Microsoft Corporation - Common" & @CRLF & _
"Stock (MSFT) [OP]P 02/13/2024 03/05/2024 $500,001 -" & @CRLF & _
"$1,000,000" & @CRLF & _
"F S: New" & @CRLF & _
"S O: Morgan Stanley - Portfolio Management Active Assets Account" & @CRLF & _
"D: Call options; Strike price $170; Expires 01/17 /2025" & @CRLF & _
"C: Ref: 044Q34N6"
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