#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^https?://[^/]+/gummybear(?:/?|/?#.*)$"
Local $sString = "examples it should be true for" & @CRLF & _
"" & @CRLF & _
"https://www.example.com:81/gummybear/" & @CRLF & _
"http://www.example.com/gummybear#top" & @CRLF & _
"https://example.com:81/gummybear#/foobar/?search=params" & @CRLF & _
"http://www.exa.mple.com:81/gummybear" & @CRLF & _
"https://example.com:81/gummybear/#/exaple/1234/" & @CRLF & _
"" & @CRLF & _
"examples that it should be false for" & @CRLF & _
"" & @CRLF & _
"https://www.example.com:81/foo/gummybear/" & @CRLF & _
"https://www.example.com:81/guMmybear/" & @CRLF & _
"https://www.example.com:81/gummybear.html" & @CRLF & _
"http://www.example.com/gummybear/apple#top" & @CRLF & _
"file://example.com:81/gummybear#/foobar/?search=params" & @CRLF & _
"http://www.exa.mple.com:81/gummybear?search=apple#lol" & @CRLF & _
"https://example.com:81/#/gummybear/" & @CRLF & _
"http://www.test.com:81/dir/dir.2/index.htm?q1=0&&test1&test2=value#top" & @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