#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "01(?=\.jpg)(.*)(\d{2}).jpg"
Local $sString = " <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_55.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_56.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_57.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_58.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_59.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_60.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_61.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_62.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_63.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_64.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_65.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_66.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_67.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_68.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_69.jpg" media-type="image/jpeg"/>" & @CRLF & _
" <item id="P2_0102_01.jpg" href="images/01_02/P2_0102_70.jpg" media-type="image/jpeg"/>"
Local $sSubst = "\2\1\2.jpg"
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