#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)((a-zA-Z){2}\/)?(app|album|book|audiobook|author|movie|movie-collection|studio|artist|developer|music-video|video|podcast|tv-season|tv-show)\/((a-zA-Z0-9\-)*\/)?(id)?(0-9)*"
Local $sString = "//bad link examples from past traffic:" & @CRLF & _
"/bkp.sql.tar.gz" & @CRLF & _
"/bkp.sql.tar.gz" & @CRLF & _
"/core/modules/system/tests/modules/error_service_test/src/Logger" & @CRLF & _
"/_get/spool/kjax/rrmjaxfl.923e30d17ca8f0b37a489c818eae0577.txt.js" & @CRLF & _
"/_get/spool/kjax/rrmjaxfl.923e30d17ca8f0b37a489c818eae0577.txt.php" & @CRLF & _
"/?AT=10l9IM&i=469623817&uo=4/cat ../../../../../../../../etc/passwd " & @CRLF & _
"/?at=11lK2U/..///////..////..//////etc/passwd&forcetoken=11lK2U/..///////..////..//////etc/passwd " & @CRLF & _
"" & @CRLF & _
"//can't do anything with these, no point in calling us" & @CRLF & _
"/subscribe?app=music&at=1001lLm9&itscg=30200&itsct=addotnet&ct=884-11165151 " & @CRLF & _
"/lookup?id=622463230" & @CRLF & _
"/search?term=You're%20Not%20There%20-%20Lukas%20Graham&entity=song&media=music&country=DK&limit=1" & @CRLF & _
"/WebObjects/MZSearch.woa/wa/advancedSearch?s=143443&partnerId=2003&affToken=www.last.fm&at=10l3Sh&artistTerm=Schmetterlinge&songTerm=Wer+schreibt+die+Geschichte?" & @CRLF & _
"/actuator/jolokia" & @CRLF & _
"" & @CRLF & _
"//supported by GeniusLink" & @CRLF & _
"/app/id1235" & @CRLF & _
"/us/app/id1235" & @CRLF & _
"/us/app/among-us/id1351168404" & @CRLF & _
"/us/app/1password-7-password-manager/id1333542190?mt=12" & @CRLF & _
"/us/book/dune/id597944491" & @CRLF & _
"/us/audiobook/a-promised-land-unabridged/id1540585069" & @CRLF & _
"/us/author/c.j.-archer/id421351544?mt=11" & @CRLF & _
"/us/movie/tenet/id1538251548" & @CRLF & _
"/us/movie-collection/the-lord-of-the-rings-extended-editions-bundle/id1537502630" & @CRLF & _
"/us/studio/pixar/id81758682" & @CRLF & _
"/us/album/willow/1544268281?i=1544268298" & @CRLF & _
"/us/album/evermore/1544268281" & @CRLF & _
"/us/artist/taylor-swift/159260351" & @CRLF & _
"/us/music-video/i-dont-care-bonus-video/1445881948" & @CRLF & _
"/au/video/id254295715?mt=5" & @CRLF & _
"/us/podcast/the-chernobyl-podcast/id1459712981" & @CRLF & _
"/us/tv-season/freight-trains-and-monsters/id1514426968?i=1520794309" & @CRLF & _
"/us/tv-season/yellowstone-season-3/id1514426968" & @CRLF & _
"/ca/tv-show/come-fly-with-me/id410581843" & @CRLF & _
"/us/developer/tapbots/id293642940" & @CRLF & _
"/video/histories/id253624330?uo=5&AT=10l9IM" & @CRLF & _
"/video/course-you-know-this-means/id665084512?uo=5&AT=10l9IM " & @CRLF & _
"/artist/jaime-urrutia/id27431058?uo=5&at=1010l34Ub&ct=cart&app=music" & @CRLF & _
"/app/noteshelf-2/id1271086060?mt=8&uo=4&at=11l9z8" & @CRLF & _
"/album/1552222070?uo=4&app=itunes&at=1l3vpUI&lId=22814830&cId=none&sr=6&src=Linkfire&itscg=30440&itsct=catchall_p6&ct=LFV_44d9b6dc091636bfbe66b473b4135330&ls=1" & @CRLF & _
"" & @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