#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)((<(p|h3.*)>.*<\/(.*)>)|(<(ul.*)>[\s\S]*<\/(ul)>))"
Local $sString = "<h1>This is heading 1</h1>" & @CRLF & _
"<h2 style="color: aqua">This is heading 2</h2>" & @CRLF & _
"<h3>This is heading 3</h3>" & @CRLF & _
"<p>This is a paragraph.</p>" & @CRLF & _
"<p>This is another paragraph.</p>" & @CRLF & _
"<a href="https://www.w3schools.com">This is a link</a>" & @CRLF & _
"<ul>" & @CRLF & _
" <li>Coffee</li>" & @CRLF & _
" <li>Tea</li>" & @CRLF & _
" <li>Milk</li>" & @CRLF & _
"</ul>"
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