#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\s?\battr\s*=\s*"\s*"|\s?\battr\b\s*=(?![^=<>]*")(?!\s*=)|\s?\battr\b(?![^=<>]*")(?!\s*=)"
Local $sString = "<img src="/test-image_1.jpg" attr attr="test-image_1" qwe="asd" attr>" & @CRLF & _
"<img src="/test-image_1.jpg" attr="test-image_1" qwe="asd" attr=>" & @CRLF & _
"<img src="/test-image_1.jpg" attr= "test-image_1" qwe="asd" attr="">" & @CRLF & _
"<img src="/test-image_1.jpg" attr= "test-image_1" qwe="asd" attr=" ">" & @CRLF & _
"<img attr="a attr b" src="/test-imagalte_1.jpg" attr qwe="asd" />" & @CRLF & _
"<img src="/test- alt image_1.jpg" attr="test-image_1" attr= "" qwe="asd" >" & @CRLF & _
"<img src="/test-image_1.jpg" attr = " " asd=" q" attr="test-image_1" attr qwe="asd" >" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"<img src="/test-image_1.jpg" attr= "test-image_1" qwe="asd" attr=" d " attr = " d " attr= " d ">" & @CRLF & _
"<img attr="test-image_1" qwe="asd" attr >" & @CRLF & _
"<img attr="test-image_1" qwe="asd" battr >" & @CRLF & _
"<img attr="test-image_1" qwe="asd" attrh >" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"<img attr="test-image_1" qwe="asd" attr >" & @CRLF & _
"<img attr="test-image_1" qwe="asd" attr =>" & @CRLF & _
"<img attr="test-image_1" qwe="asd" attr=>" & @CRLF & _
"<img attr="test-image_1" qwe="asd" battr = "" >" & @CRLF & _
"<img attr="test-image_1" qwe="asd" attrh= " " >" & @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