#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)<Rectangle[^>]*>3\$[^<]*<\/Rectangle>"
Local $sString = "<Rectangle is " & @CRLF & _
" good>99$1</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" bad>99$2</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" ugly>3$3</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" fat>99$4</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" janky6789>99$5</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" 34+35>99$6</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" <>>98$7</Rectangle>" & @CRLF & _
"<Rectangle is " & @CRLF & _
" chicken>3$8</Rectangle>" & @CRLF & _
"<Rectangle 1 is " & @CRLF & _
" holy>97$9</Rectangle>"
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