#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\s*(?(?=<)<\s*(\w+)(?:\s+[^\s>]+=("|'|)[^\s"'>]+\2)*\s*(\/\s*)?>(?(3)|(?R)<\s*\/\s*\1\s*>)|[^<]*)*\s*"
Local $sString = "<catalog>" & @CRLF & _
" <book id="bk101">" & @CRLF & _
" <author>Gambardella, Matthew</author>" & @CRLF & _
" <title>XML Developer's Guide</title>" & @CRLF & _
" <genre>Computer</genre>" & @CRLF & _
" <price>44.95</price>" & @CRLF & _
" <publish_date>2000-10-01</publish_date>" & @CRLF & _
" <description>An in-depth look at creating applications " & @CRLF & _
" with XML.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk102">" & @CRLF & _
" <author>Ralls, Kim</author>" & @CRLF & _
" <title>Midnight Rain</title>" & @CRLF & _
" <genre>Fantasy</genre>" & @CRLF & _
" <price>5.95</price>" & @CRLF & _
" <publish_date>2000-12-16</publish_date>" & @CRLF & _
" <description>A former architect battles corporate zombies, " & @CRLF & _
" an evil sorceress, and her own childhood to become queen " & @CRLF & _
" of the world.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk103">" & @CRLF & _
" <author>Corets, Eva</author>" & @CRLF & _
" <title>Maeve Ascendant</title>" & @CRLF & _
" <genre>Fantasy</genre>" & @CRLF & _
" <price>5.95</price>" & @CRLF & _
" <publish_date>2000-11-17</publish_date>" & @CRLF & _
" <description>After the collapse of a nanotechnology " & @CRLF & _
" society in England, the young survivors lay the " & @CRLF & _
" foundation for a new society.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk104">" & @CRLF & _
" <author>Corets, Eva</author>" & @CRLF & _
" <title>Oberon's Legacy</title>" & @CRLF & _
" <genre>Fantasy</genre>" & @CRLF & _
" <price>5.95</price>" & @CRLF & _
" <publish_date>2001-03-10</publish_date>" & @CRLF & _
" <description>In post-apocalypse England, the mysterious " & @CRLF & _
" agent known only as Oberon helps to create a new life " & @CRLF & _
" for the inhabitants of London. Sequel to Maeve " & @CRLF & _
" Ascendant.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk105">" & @CRLF & _
" <author>Corets, Eva</author>" & @CRLF & _
" <title>The Sundered Grail</title>" & @CRLF & _
" <genre>Fantasy</genre>" & @CRLF & _
" <price>5.95</price>" & @CRLF & _
" <publish_date>2001-09-10</publish_date>" & @CRLF & _
" <description>The two daughters of Maeve, half-sisters, " & @CRLF & _
" battle one another for control of England. Sequel to " & @CRLF & _
" Oberon's Legacy.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk106">" & @CRLF & _
" <author>Randall, Cynthia</author>" & @CRLF & _
" <title>Lover Birds</title>" & @CRLF & _
" <genre>Romance</genre>" & @CRLF & _
" <price>4.95</price>" & @CRLF & _
" <publish_date>2000-09-02</publish_date>" & @CRLF & _
" <description>When Carla meets Paul at an ornithology " & @CRLF & _
" conference, tempers fly as feathers get ruffled.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk107">" & @CRLF & _
" <author>Thurman, Paula</author>" & @CRLF & _
" <title>Splish Splash</title>" & @CRLF & _
" <genre>Romance</genre>" & @CRLF & _
" <price>4.95</price>" & @CRLF & _
" <publish_date>2000-11-02</publish_date>" & @CRLF & _
" <description>A deep sea diver finds true love twenty " & @CRLF & _
" thousand leagues beneath the sea.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk108">" & @CRLF & _
" <author>Knorr, Stefan</author>" & @CRLF & _
" <title>Creepy Crawlies</title>" & @CRLF & _
" <genre>Horror</genre>" & @CRLF & _
" <price>4.95</price>" & @CRLF & _
" <publish_date>2000-12-06</publish_date>" & @CRLF & _
" <description>An anthology of horror stories about roaches," & @CRLF & _
" centipedes, scorpions and other insects.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk109">" & @CRLF & _
" <author>Kress, Peter</author>" & @CRLF & _
" <title>Paradox Lost</title>" & @CRLF & _
" <genre>Science Fiction</genre>" & @CRLF & _
" <price>6.95</price>" & @CRLF & _
" <publish_date>2000-11-02</publish_date>" & @CRLF & _
" <description>After an inadvertant trip through a Heisenberg" & @CRLF & _
" Uncertainty Device, James Salway discovers the problems " & @CRLF & _
" of being quantum.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk110">" & @CRLF & _
" <author>O'Brien, Tim</author>" & @CRLF & _
" <title>Microsoft .NET: The Programming Bible</title>" & @CRLF & _
" <genre>Computer</genre>" & @CRLF & _
" <price>36.95</price>" & @CRLF & _
" <publish_date>2000-12-09</publish_date>" & @CRLF & _
" <description>Microsoft's .NET initiative is explored in " & @CRLF & _
" detail in this deep programmer's reference.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk111">" & @CRLF & _
" <author>O'Brien, Tim</author>" & @CRLF & _
" <title>MSXML3: A Comprehensive Guide</title>" & @CRLF & _
" <genre>Computer</genre>" & @CRLF & _
" <price>36.95</price>" & @CRLF & _
" <publish_date>2000-12-01</publish_date>" & @CRLF & _
" <description>The Microsoft MSXML3 parser is covered in " & @CRLF & _
" detail, with attention to XML DOM interfaces, XSLT processing, " & @CRLF & _
" SAX and more.</description>" & @CRLF & _
" </book>" & @CRLF & _
" <book id="bk112">" & @CRLF & _
" <author>Galos, Mike</author>" & @CRLF & _
" <title>Visual Studio 7: A Comprehensive Guide</title>" & @CRLF & _
" <genre>Computer</genre>" & @CRLF & _
" <price>49.95</price>" & @CRLF & _
" <publish_date>2001-04-16</publish_date>" & @CRLF & _
" <description>Microsoft Visual Studio 7 is explored in depth," & @CRLF & _
" looking at how Visual Basic, Visual C++, C#, and ASP+ are " & @CRLF & _
" integrated into a comprehensive development " & @CRLF & _
" environment.</description>" & @CRLF & _
" </book>" & @CRLF & _
"</catalog>"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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