#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)image(\d)$"
Local $sString = "image1" & @CRLF & _
"image2" & @CRLF & _
"image3" & @CRLF & _
"image4" & @CRLF & _
"image5" & @CRLF & _
"image6" & @CRLF & _
"image7" & @CRLF & _
"image8" & @CRLF & _
"image9" & @CRLF & _
"image10" & @CRLF & _
"image11" & @CRLF & _
"image12" & @CRLF & _
"image13" & @CRLF & _
"image14" & @CRLF & _
"image15" & @CRLF & _
"image100" & @CRLF & _
"image101" & @CRLF & _
"image102" & @CRLF & _
"image103" & @CRLF & _
"image104" & @CRLF & _
"image105"
Local $sSubst = "image00$1"
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