#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?si)\[([^\[\]]*?)\]\((\S*?)\)"
Local $sString = "# Basic Cases" & @CRLF & _
"" & @CRLF & _
"[test link](http://test.com)" & @CRLF & _
"" & @CRLF & _
"[test-link@test.com](http://test.com/test-link)" & @CRLF & _
"" & @CRLF & _
"[title (parenthesis)](http://www.test.com)" & @CRLF & _
"" & @CRLF & _
"[relative link](/test-link/page)" & @CRLF & _
"" & @CRLF & _
"[anchor reference](#reference)" & @CRLF & _
"" & @CRLF & _
"[title with" & @CRLF & _
"linebreak](http://test.com)" & @CRLF & _
"" & @CRLF & _
"# Extra Cases" & @CRLF & _
"" & @CRLF & _
"[]()" & @CRLF & _
"" & @CRLF & _
"[](uri:empty-title)" & @CRLF & _
"" & @CRLF & _
"[[extra sq bracket](ftp://test.com)" & @CRLF & _
"" & @CRLF & _
"[extra sq bracket - invalid]](https://test.com)" & @CRLF & _
"" & @CRLF & _
"[extra parentheses](((())))" & @CRLF & _
"" & @CRLF & _
"[link with linebreak - invalid](http:" & @CRLF & _
"//test.com)" & @CRLF & _
"" & @CRLF & _
"# Lazy Delimiter Testing" & @CRLF & _
"" & @CRLF & _
"[()][()][(][)[][]))([()[(((][(]][)([(])))[()" & @CRLF & _
"" & @CRLF & _
"[((()))]()" & @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