#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?<=\/)[\w\-.]+(?=(\?|(\s*)$|(\/)$))"
Local $sString = "https://www.tokopedia.com/laris88/tempat-bumbu-dapur-4-sekat-joyfeel-1047-seasoning-storage-merah-muda" & @CRLF & _
"https://www.tokopedia.com/tenonenonet/gift-box-kotak-kado-souvenir-hadiah-ukuran-14-x-14-x-5cm-plus-tali?whid=0" & @CRLF & _
"https://www.tokopedia.com/tenonenonet/gift-box-kotak-kado-souvenir-hadiah-ukuran-14-x-14-x-5cm-plus-tali" & @CRLF & _
"https://gql.tokopedia.com/tokopedia.com/" & @CRLF & _
"https://gql.tokopedia.com/ceriasmart/" & @CRLF & _
"https://gql.tokopedia.com/22ceria.-smart/" & @CRLF & _
"" & @CRLF & _
"tokopedia\.com/([^/]+[\w])" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"todo" & @CRLF & _
"i want grab only "gift-box-kotak-kado-souvenir-hadiah-ukuran-14-x-14-x-5cm-plus-tali" without end character '?'" & @CRLF & _
"" & @CRLF & _
"tokopedia\.com/[^/]*[\w\/](.*)|[?!\?]"
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