#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\[[^][]*](*SKIP)(*F)|(?:https?://)?(?:www\.)?[\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[\w-@:%+.~#?&/=]*"
Local $sString = "www.example.com " & @CRLF & _
"http://example.com.nz " & @CRLF & _
"example.com" & @CRLF & _
"http://www.example.com?2rjl6" & @CRLF & _
"example.com/first/second" & @CRLF & _
"https://example.us.edi?34535/534534?dfg=g&fg" & @CRLF & _
"" & @CRLF & _
"etc..." & @CRLF & _
"I want no match if any of the above URLs are enclosed in square brackets [ ] like this:" & @CRLF & _
"" & @CRLF & _
"[www.example.com]" & @CRLF & _
"[http://example.com.nz]" & @CRLF & _
"etc..." & @CRLF & _
"" & @CRLF & _
".aaaa" & @CRLF & _
"" & @CRLF & _
"e.g." & @CRLF & _
"" & @CRLF & _
"Lorem ipsum dolor sit amet, consectetur [http://example.com.nz] llamcorper et lacus. Morbi sodales convallis lectus a efficitur: example.com/first/second vitae nisl placerat." & @CRLF & _
"" & @CRLF & _
"Fusce non ipsum a augue http://example.com.nz http://www.example.com?2rjl6 aculis augue. Nullam eu nulla lectus."
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