#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)!.*?.(png|jpg|jpeg|bmp)(\|(thumbnail|(width=\d+,height=\d+)|(width=\d+)|(height=\d+)))?!"
Local $sString = "!Screenshot 2023-01-09 at 11.30.10.png|width=476,height=137!" & @CRLF & _
"!Screenshot 2023-01-09 at 11.30.10.png|width=476!" & @CRLF & _
"!Screenshot 2023-01-09 at 11.30.10.png|height=137!" & @CRLF & _
"!image-2023-03-31-10-31-58-083.png!" & @CRLF & _
"!test_image.jpg!" & @CRLF & _
"!test_image.jpeg!"
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