#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)<h4>(?:(?!<\/?h4>).)*?<\/h4>(?!.*?<div class='content'>)"
Local $sString = "<div class='content'>" & @CRLF & _
" <img style='border-style: solid; border-width: 1px;' src='/media/uploads/defaults/181'/><br/><br/>" & @CRLF & _
" <div class='imgCaption'>" & @CRLF & _
" Reverse Osmosis Caption" & @CRLF & _
" </div>" & @CRLF & _
"</div>" & @CRLF & _
"<pagebreak/>" & @CRLF & _
"<h3>Access </h3>" & @CRLF & _
"<h4>Type</h4>" & @CRLF & _
"<div class='content'>" & @CRLF & _
" Your plumbing system is accessible with a Main Shut off Valves" & @CRLF & _
"</div>" & @CRLF & _
"<h4>Location</h4>" & @CRLF & _
"<pagebreak/>" & @CRLF & _
"<h3>Operation & maintenance #1</h3>" & @CRLF & _
"<div class='content'>" & @CRLF & _
" All wastewater treatment systems and their components require regular maintenance." & @CRLF & _
"</div>" & @CRLF & _
"<h4>Activity</h4>"
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