#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)<([^ \>]++) ?[^>]*+>(.*?(?:<([^ \>]++) ?[^>]*+>(?:[^<]*+|(?2))<\/ ?\3>|<[^ \/>]++ ?\/>).*?)<\/ ?\1>"
Local $sString = "<bookstore>" & @CRLF & _
" <book category="CHILDREN">" & @CRLF & _
" <title>Harry Potter</title>" & @CRLF & _
" <author>J K. Rowling</author>" & @CRLF & _
" <year>2005</year>" & @CRLF & _
" <price>29.99</price>" & @CRLF & _
" </book>" & @CRLF & _
" <book category="WEB">" & @CRLF & _
" <title>Learning XML</title>" & @CRLF & _
" <author>Erik T. Ray</author>" & @CRLF & _
" <year>2003</year>" & @CRLF & _
" <price>39.95</price>" & @CRLF & _
" </book>" & @CRLF & _
"</bookstore>"
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