#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?<!BM\.)(?<=\W)Draw(Image|Text)\s*([^\;\n]+)(\;|$)"
Local $sString = " BM.DrawImage(GameOverImg,MW-ImageWidth(GameOverImg) , MH-ImageHeight(GameOverImg));" & @CRLF & _
" " & @CRLF & _
" gotxt=GetTextLine(60);" & @CRLF & _
" break;" & @CRLF & _
" " & @CRLF & _
" case 0: // если пориграли" & @CRLF & _
" BM.SetColor(255,0,0);" & @CRLF & _
" DrawImage GameOverImg,MW-ImageWidth(GameOverImg) , MH-ImageHeight(GameOverImg);" & @CRLF & _
"" & @CRLF & _
" DrawText string gotxt,MW-TextWidth(gotxt)/2 , MH-TextHeight(gotxt)/2"
Local $sSubst = "BM.Draw$1($2)$3"
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