#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?ms)<(?<tagName>\w+)((>)|(.+?>))(.+?)?<\/\k<tagName>>"
Local $sString = "<transaction>" & @CRLF & _
" <id>6753322</id>" & @CRLF & _
" <number region="Russia">8-900-000-00-00</number>" & @CRLF & _
" <nonattr />" & @CRLF & _
" <nonattr></nonattr>" & @CRLF & _
" <nonattr>text</nonattr>" & @CRLF & _
" <attr id="1" />" & @CRLF & _
" <attr id="2"></attr>" & @CRLF & _
" <attr id="3">text</attr>" & @CRLF & _
" <email>" & @CRLF & _
" <to>to_example@gmail.com</to>" & @CRLF & _
" <from>from_example@gmail.com</from>" & @CRLF & _
" <subject>Project discussion</subject>" & @CRLF & _
" <body font="Verdana">Body message</body>" & @CRLF & _
" <date day="12" month="12" year="2018"/>" & @CRLF & _
" </email>" & @CRLF & _
"</transaction>" & @CRLF & _
"" & @CRLF & _
"<number region="Russia">8-900-000-00-00</number>" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"<nonattr></nonattr>" & @CRLF & _
"" & @CRLF & _
"<attr id="2"></attr>" & @CRLF & _
"" & @CRLF & _
"<body font="Verdana">Body message</body>" & @CRLF & _
"" & @CRLF & _
" <email>" & @CRLF & _
" <to>to_example@gmail.com</to>" & @CRLF & _
" <from>from_example@gmail.com</from>" & @CRLF & _
" <subject>Project discussion</subject>" & @CRLF & _
" <body font="Verdana">Body message</body>" & @CRLF & _
" <date day="12" month="12" year="2018"/>" & @CRLF & _
" </email>" & @CRLF & _
"" & @CRLF & _
""
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