#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(<\/?img.*[^-]width\s?[:|=]\s?['|"]?)[0-9]+px(.*)>"
Local $sString = "<img >" & @CRLF & _
"<img />" & @CRLF & _
"<img >width" & @CRLF & _
"<img width >" & @CRLF & _
"<img src = "">" & @CRLF & _
"<strong><img width="500px" style = 'color:5px' width="500px;" /></strong>" & @CRLF & _
"<img style = 'height:50px;' width=500px />" & @CRLF & _
"<strong><img style = 'color:5px' width="5000px;" /></strong>" & @CRLF & _
"<img style = 'color:5px;width:265px;' />" & @CRLF & _
"<img style = 'color:5px;width:50%;' />" & @CRLF & _
"<img style = 'width:50%;' />" & @CRLF & _
"<img style = 'height:50px;' />" & @CRLF & _
"<img style="width: 5px;" />"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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