#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "<\s*[a-z]*[^>]*>(.*?)<\s*/\s*[a-z]*>|<[\w]*>(.*?)<[/\w]*>"
Local $sString = "<body>" & @CRLF & _
"" & @CRLF & _
"<div class="header">" & @CRLF & _
" <h1>My Website</h1>" & @CRLF & _
" <p>A <b>responsive</b> website created by me.</p>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"<div class="navbar">" & @CRLF & _
" <a href="#" class="active">Home</a>" & @CRLF & _
" <a href="#">Link</a>" & @CRLF & _
" <a href="#">Link</a>" & @CRLF & _
" <a href="#" class="right">Link</a>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"<div class="row">" & @CRLF & _
" <div class="side">" & @CRLF & _
" <h2>About Me</h2>" & @CRLF & _
" <h5>Photo of me:</h5>" & @CRLF & _
" <div class="fakeimg" style="height:200px;">Image</div>" & @CRLF & _
" <p>Some text about me in culpa qui officia deserunt mollit anim..</p>" & @CRLF & _
" <h3>More Text</h3>" & @CRLF & _
" <p>Lorem ipsum dolor sit ame.</p>" & @CRLF & _
" <div class="fakeimg" style="height:60px;">Image</div><br>" & @CRLF & _
" <div class="fakeimg" style="height:60px;">Image</div><br>" & @CRLF & _
" <div class="fakeimg" style="height:60px;">Image</div>" & @CRLF & _
" </div>" & @CRLF & _
" <div class="main">" & @CRLF & _
" <h2>TITLE HEADING</h2>" & @CRLF & _
" <h5>Title description, Dec 7, 2017</h5>" & @CRLF & _
" <div class="fakeimg" style="height:200px;">Image</div>" & @CRLF & _
" <p>Some text..</p>" & @CRLF & _
" <p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p>" & @CRLF & _
" <br>" & @CRLF & _
" <h2>TITLE HEADING</h2>" & @CRLF & _
" <h5>Title description, Sep 2, 2017</h5>" & @CRLF & _
" <div class="fakeimg" style="height:200px;">Image</div>" & @CRLF & _
" <p>Some text..</p>" & @CRLF & _
" <p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p>" & @CRLF & _
" </div>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"<div class="footer">" & @CRLF & _
" <h2>Footer</h2>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"</body>"
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