#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)<loc>[^>]*\K\d{6}(?=/</loc>)"
Local $sString = "<?xml version="1.0" encoding="utf-8"?>" & @CRLF & _
"<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/concrete/hand-tools/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:10:42+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/concrete/hand-tools/screws/screws-145890/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:06+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/concrete/hand-tools/screws/screws-145489/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:14+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/concrete/hand-tools/hammer/hammer-145488/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:10:42+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/inside/heating/floor-heating/pert-222-010274/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:06+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/paint/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:14+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/screws-and-nails/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:10:42+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/building-materials/concrete/power-toools/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:06+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/inside/heating/floor-heating/pert-182-010272/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:14+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/inside/heating/floor-heating/pert-202-010273/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:10:42+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/inside/bathroom/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:06+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
" <url>" & @CRLF & _
" <loc>https://somelink.com/category/inside/pipes/draining-pipes-168544/</loc>" & @CRLF & _
" <lastmod>2022-09-11T02:11:14+02:00</lastmod>" & @CRLF & _
" <changefreq>weekly</changefreq>" & @CRLF & _
" <priority>0.8</priority>" & @CRLF & _
" </url>" & @CRLF & _
"</xml>"
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