#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?im)((?:https?:\/\/)?(?:www\.)?domain\.com(?!\S*\?))(\S*)"
Local $sString = "www.domain.com dsa dsad sad sad sa" & @CRLF & _
"domain.com asdasds adas dsa" & @CRLF & _
"www.domain.com/someurl/?d sad sadsad" & @CRLF & _
"www.domain.com/someurl/ asd asd sa" & @CRLF & _
"www.domain.com?id=123 sd asdsa d<hr>" & @CRLF & _
""
Local $sSubst = "$1$2?add_text"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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