#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:[^!]\[(?P<caption>.*?)\])\((?P<image>.*?)\)"
Local $sString = "This is a regex to detect markdown image links of the form ![image caption](image URL)" & @CRLF & _
"" & @CRLF & _
"![Caption.](image.png){#fig:id}" & @CRLF & _
"![Caption.](image.png){#fig:id tag="B.1"}" & @CRLF & _
"![This is a sample image representing the VOD curve of a packaged Watergel explosive.](../assets/1v6C9yek3pHsXSeOlR4glzDMkFqFHizR6VXr79tEOnY=.png){#fig:ch0_1_images-1 width=100%}" & @CRLF & _
"![](../../assets/E5WnRoSH_Dqrzl8f5_ZJ9AjWc-53BgiBqD_xTqEp6pM=.png)" & @CRLF & _
"![](../../assets/l2mxAo3IR1dc3Wrgt7Ulqhcm_8nwqFw5UY7pUI3X0oI=.png)" & @CRLF & _
"![](../../assets/Y7jjv0ceQH5Ew5O32U2Z_N7ARBfKn2FnHnUoUt_DYbA=.png)" & @CRLF & _
"![](../../assets/eOvy-JcdA7pjoDJS4rIgG5RgDfYJ4PY11Owbgy5DHWM=.png)" & @CRLF & _
"![](../../assets/XwMrG0o__iLF5nStoSPUuJ81ffxafRBWAVnEcGo10Yo=.png)" & @CRLF & _
"![](../../assets/AfHKsc518nK6Ew2MHJt96lJMkTiVAyIiuva6L-lRQaQ=.png)" & @CRLF & _
"![](../../assets/JyDHFl6DyL1mw5EI-pSb9ssNzmbsEaSPQn5AOiZqeiM=.png)" & @CRLF & _
"![](../../assets/BYGvFWn41qFZuU3C7Jyd1uHjs8Cib8eEJod0sIze9S0=.png)" & @CRLF & _
"![](../../assets/77U97Em8AN06LCGVxH6UQ_Lh3OZkNsJRkMZY1nBMVrA=.png)" & @CRLF & _
"![](../../assets/iPkPth_Vh_wSgeD0wqxlctDyDEmgHfYuhTqBQE6mynI=.png)" & @CRLF & _
"![](../../assets/h57_b4_XeFd5SR1iYLu9WsYNy_n8sM6rPbQdGephk1c=.png)" & @CRLF & _
"![](../../assets/u8Y_44VG3-pD8fweuazkSN9fflhJfgCqOtc2ooP2sVM=.png)" & @CRLF & _
"![](../../assets/dc-ExOEXIWnH0qwVHTSNmFljUwyKS0xeEYFxS98ZEYg=.png)" & @CRLF & _
"![](../../assets/nJZLBZEOCiOT2P1F2c5mVQZrCrIJB5i1EnRgT767WWo=.png)" & @CRLF & _
"![](../../assets/ilG_dm7Lr3315RFsUdJCW7tkJbTZlnmV_NNKFBDeyxc=.png)" & @CRLF & _
"![](../../assets/1v6C9yek3pHsXSeOlR4glzDMkFqFHizR6VXr79tEOnY=.png)" & @CRLF & _
"![](../../assets/Bw1eWhlyutzMa8Eg94-VnSk_TsffrBLeoZKWySkMwIw=.png)" & @CRLF & _
"![](../../assets/9RIkA4mInkKNSIxMi7ctUozBJPUqlHPugIfG2yr37Co=.png)" & @CRLF & _
"![Hyperbola](../../assets/300px-Hyperbola_properties.svg.png)" & @CRLF & _
"![Hyperbola](../../assets/HyperbolaAnatomyLeft.png)" & @CRLF & _
"![Hyperbola](../../assets/HyperbolaAnatomyRight.png)" & @CRLF & _
"![](../../assets/IsXLnPl1wKraeLnryg2rOxtYdGSSHg8vTTN1ObV0Dt8=.png)"
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