#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xuJ)<url>\s*" & @CRLF & _
" (?>" & @CRLF & _
" (?>" & @CRLF & _
" (?><lastmod>\s*(?<mod>[^<]+)\s*</lastmod>)" & @CRLF & _
" |" & @CRLF & _
" (?><changefreq>\s*(?<freq>\w+)\s*</changefreq>)" & @CRLF & _
" |" & @CRLF & _
" (?><priority>\s*(?<prio>[01](?>\.\d{1,2})?)\s*</priority>)" & @CRLF & _
" )\s*" & @CRLF & _
" ){0,3}\s*" & @CRLF & _
" <loc>\s*" & @CRLF & _
" (?<uri>[^<]+)\s*" & @CRLF & _
" </loc>\s*" & @CRLF & _
" (?>" & @CRLF & _
" (?>" & @CRLF & _
" (?><lastmod>\s*(?<mod>[^<]+)\s*</lastmod>)" & @CRLF & _
" |" & @CRLF & _
" (?><changefreq>\s*(?<freq>\w+)\s*</changefreq>)" & @CRLF & _
" |" & @CRLF & _
" (?><priority>\s*(?<prio>[01](?>\.\d{1,2})?)\s*</priority>)" & @CRLF & _
" )\s*" & @CRLF & _
" ){0,3}\s*" & @CRLF & _
"</url>"
Local $sString = "<?xml version="1.0" encoding="UTF-8"?>" & @CRLF & _
"<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">" & @CRLF & _
" <url>" & @CRLF & _
" <lastmod>2005-01-01</lastmod>" & @CRLF & _
" <changefreq>monthly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" <loc>http://www.example.com/</loc>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>http://www.example.com/catalog?item=12&desc=vacation_hawaii</loc>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>http://www.example.com/catalog?item=73&desc=vacation_new_zealand</loc>" & @CRLF & _
" <lastmod>2004-12-23</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>http://www.example.com/catalog?item=74&desc=vacation_newfoundland</loc>" & @CRLF & _
" <lastmod>2004-12-23T18:00:15+00:00</lastmod>" & @CRLF & _
" <priority>0.3</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>http://www.example.com/catalog?item=83&desc=vacation_usa</loc>" & @CRLF & _
" <lastmod>2004-11-23</lastmod>" & @CRLF & _
" </url>" & @CRLF & _
"</urlset>"
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