#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^https?:\/\/www\.google((\..{1,3}){1,2})\/(search\?)(?!flights|maps)(?!.*&tbm=(shop|fin|lcl)&).*"
Local $sString = "#images" & @CRLF & _
"https://www.google.com/search?q=finance&hl=en&tbm=isch&sxsrf=ALeKk03-wtxJ6IxBQ1QplyRfSUR5Zq6p5w:1588804525013&source=lnms&sa=X&ved=0ahUKEwjsstKKpqDpAhWIiqQKHeGbDWcQ_AUICygC&biw=2560&bih=1307&dpr=1" & @CRLF & _
"" & @CRLF & _
"#books" & @CRLF & _
"https://www.google.com/search?q=finance&hl=en&sxsrf=ALeKk020ZKe6S8ZciwePz_FDqQNjlrIyMw:1588804501205&source=lnms&tbm=bks&sa=X&ved=2ahUKEwiuraX_paDpAhUHLBoKHbvWAKYQ_AUoAXoECBgQCQ&biw=2560&bih=1307" & @CRLF & _
"" & @CRLF & _
"#all" & @CRLF & _
"https://www.google.com/search?q=finance&hl=en&sxsrf=ALeKk02-xP9nE6zHjjatj9fSG3th2_3zzw:1588804479887&source=lnms&sa=X&ved=0ahUKEwi0k5D1paDpAhWJ-qQKHW1XANcQ_AUIDSgA&biw=2560&bih=1307&dpr=1" & @CRLF & _
"" & @CRLF & _
"#news" & @CRLF & _
"https://www.google.com/search?q=finance&source=lmns&tbm=nws&bih=1307&biw=2560&hl=en&ved=2ahUKEwi2jsnCpaDpAhWF44UKHcvnDusQ_AUoAXoECAEQAQ" & @CRLF & _
"" & @CRLF & _
"####Dont match following" & @CRLF & _
"" & @CRLF & _
"#finance" & @CRLF & _
"https://www.google.com/search?hl=en&biw=2560&bih=1307&tbm=fin&sxsrf=ALeKk00e_wrvwwyEY7nhVKV8j5IvHPK8rQ%3A1588802138647&ei=WjKzXuX1JofVkwWv-p24Dg&q=finance&oq=finance&gs_l=finance-immersive.3...980.1734.0.1817.7.5.0.0.0.0.208.208.2-1.1.0....0...1.1.64.finance-immersive..6.1.208...81.0.T31TXEhQon8" & @CRLF & _
"" & @CRLF & _
"#flights" & @CRLF & _
"https://www.google.com/flights?q=testt&bih=1307&biw=2560&hl=en&tbm=flm&sxsrf=ALeKk03tMI1tx59I3Jc-LJfPj3_gEihKyA:1588801776819&source=lnms&sa=X&ved=0ahUKEwiugJrsm6DpAhVNDOwKHRFgCLkQ_AUINSgD#flt=/m/04jpl..2020-05-22*./m/04jpl.2020-05-26;c:GBP;e:1;ls:1w;sd:0;t:h" & @CRLF & _
"" & @CRLF & _
"#maps" & @CRLF & _
"https://www.google.com/maps?hl=en&biw=2560&bih=1307&sxsrf=ALeKk00e_wrvwwyEY7nhVKV8j5IvHPK8rQ:1588802138647&q=finance&um=1&ie=UTF-8&sa=X&ved=2ahUKEwiY2IGanaDpAhVFCewKHYSIDCwQ_AUoAHoECAEQCA" & @CRLF & _
"" & @CRLF & _
"#maps widget in search" & @CRLF & _
"https://www.google.com/search?q=finance&source=lmns&bih=1307&biw=2560&hl=en&ved=2ahUKEwjd86Po7qLpAhWFs3EKHVkiBy0QvS4wDnoECBEQHQ&sxsrf=ALeKk02paj14dQam1LLme0LY76me3nxOSw:1588892768213&npsic=0&rflfq=1&rlha=0&rllag=52234121,132579,226&tbm=lcl&rldimm=12043644416834703012&lqi=CgdmaW5hbmNlWhIKB2ZpbmFuY2UiB2ZpbmFuY2U&rldoc=1&tbs=lrf:!1m4!1u3!2m2!3m1!1e1!1m4!1u16!2m2!16m1!1e1!1m4!1u16!2m2!16m1!1e2!2m1!1e16!2m1!1e3!3sIAE,lf:1,lf_ui:2&rlst=f#rlfi=hd:;si:12043644416834703012,l,CgdmaW5hbmNlWhIKB2ZpbmFuY2UiB2ZpbmFuY2U;mv:[[54.130455193219696,5.088306911880459],[50.21534923934904,-6.66706418186956]]" & @CRLF & _
"" & @CRLF & _
"#shopping" & @CRLF & _
"https://www.google.com/search?q=testt&source=lmns&tbm=shop&bih=1307&biw=2560&hl=en&ved=2ahUKEwiShpzrm6DpAhUW_hoKHQ61AEcQ_AUoAnoECAEQAg" & @CRLF & _
"" & @CRLF & _
"https://www.google.com/" & @CRLF & _
"https://www.google.fr/" & @CRLF & _
"https://www.google.cm/" & @CRLF & _
"https://www.google.co.uk/"
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