#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)^(.*)(\/[0-9]+\/[a-z]+\-[a-z]+\/?.*)\/?$"
Local $sString = "https://localhost/produkter/mun-tander/40/currentprice-asc/activesubstances_paracetamol/freefrom_Parabener/producttypemouthandteeth_Munsk%C3%B6lj/" & @CRLF & _
"https://localhost/produkter/mun-tander/40/currentprice-asc" & @CRLF & _
"https://localhost/produkter/mun-tander/40/currentprice-asc/" & @CRLF & _
"https://localhost/produkter/mun-tander/40/currentprice-asc/content/img/ios-icon.png" & @CRLF & _
"https://localhost/produkter/mun-tander/count-40/sortby-currentprice_asc/filter-activesubstances_paracetamol-freefrom_Parabener-producttypemouthandteeth_Munsk%C3%B6lj/" & @CRLF & _
"https://localhost/produkter/mun-tander/count-40/sortby-currentprice_asc/filter-activesubstances_paracetamol/filter-freefrom_Parabener/filter-producttypemouthandteeth_Munsk%C3%B6lj/" & @CRLF & _
"https://localhost/produkter/mun-tander/count-40/sortby-currentprice_asc" & @CRLF & _
"https://localhost/produkter/mun-tander/count-40/sortby-currentprice_asc/" & @CRLF & _
"https://localhost/produkter/mun-tander/count-40/sortby-currentprice_asc/content/img/ios-icon.png" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"^(.*)\/count-([0-9]+)\/sortBy-([a-z]+)_([a-z]+)((\/filter-[^\/]+)+)?\/?" & @CRLF & _
"" & @CRLF & _
"^(.*)(\/[0-9]+\/[a-z]+_[a-z]+\/?.*)\/?$"
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