#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "[\r|\n|^<]*(<a([^*>]+>)|<\/a>)"
Local $sString = "juabsdfsadfsdfsf<a href=""><h1></h1></a> sdfsdfsdf <h2>sdfsdfs</h2> <div class=""><a href=""></a><div class="block">" & @CRLF & _
" <a href="/">" & @CRLF & _
" <div class="divInside"></div>" & @CRLF & _
" <img src="/bla" /><div class="block">" & @CRLF & _
" <a href="/">" & @CRLF & _
" <div class="divInside"></div>" & @CRLF & _
" <img src="/bla" />" & @CRLF & _
" <p>Parargraph<div class="block">" & @CRLF & _
" <a href="/">" & @CRLF & _
" <div class="divInside"></div>" & @CRLF & _
" <img src="/bla" />" & @CRLF & _
" <p>Parargraph</p>" & @CRLF & _
" </a>" & @CRLF & _
"</div></p>" & @CRLF & _
" </a>" & @CRLF & _
"</div>" & @CRLF & _
" <p>Parargraph</p>" & @CRLF & _
" </a>" & @CRLF & _
"</div>"
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