#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)(?<=<\/h\d+>\s*)\S.*?(?=\s*<h\d|$)"
Local $sString = "<h2>What is lorem impsum</h2>" & @CRLF & _
"Stack overflow is a great community for developers to seek help and connect the beautiful experience." & @CRLF & _
"" & @CRLF & _
"<h3>What is quora?</h3>" & @CRLF & _
"Quoora is good but doesn\'t provide any benefits to the person who\'s helping others economically. " & @CRLF & _
"But its a nice place to be at." & @CRLF & _
"another paragraph betwen these headings" & @CRLF & _
"" & @CRLF & _
"<h3>Who is Kent C Dodds</h3>" & @CRLF & _
"One of the best guy to learn react with. He also has helped a lot of " & @CRLF & _
"people with his kindness and his contents on the internet."
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