#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?im)<img([^>]*)src="[(([^:"]*)({png|gif|jpg|jpeg}))]""
Local $sString = "<!DOCTYPE html>" & @CRLF & _
"<html>" & @CRLF & _
"<body>" & @CRLF & _
"" & @CRLF & _
"<img src="smiley.gif" alt="Smiley face" height="42" width="42" style="float:right">" & @CRLF & _
"" & @CRLF & _
"<p>Insert an image from another folder:</p>" & @CRLF & _
"<img src="/images/stickman.gif" alt="Stickman" width="24" height="39">" & @CRLF & _
"" & @CRLF & _
"<p style="float:left">Insert an image from a web site:</p>" & @CRLF & _
"<img style="color:green; float:right;" src="http://www.w3schools.com/images/lamp.gif" alt="Lamp" width="15" height="15">" & @CRLF & _
"" & @CRLF & _
"</body>" & @CRLF & _
"</html>" & @CRLF & _
""
Local $sSubst = "<img \2"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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