#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "<(\/?)\w+:(\w+\/?) ?(\w+:\w+.*)?>"
Local $sString = "<?xml version="1.0" encoding="utf-8"?>" & @CRLF & _
"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">" & @CRLF & _
" <soap:Body>" & @CRLF & _
" <ConnectResponse xmlns="aa">" & @CRLF & _
" <ConnectResult xmlns="bb">" & @CRLF & _
" <RETURNS>" & @CRLF & _
" <STATUS>A92A7EBEE897499fA8B06D5FE94B8A30</STATUS>" & @CRLF & _
" <APIPAYLOAD>" & @CRLF & _
" <COMMAND>" & @CRLF & _
" <TRACKINGID mya="cc">e3d1618b4b7847628b10d4a432ec9151</TRACKINGID>" & @CRLF & _
" </COMMAND>" & @CRLF & _
" </APIPAYLOAD>" & @CRLF & _
" </RETURNS>" & @CRLF & _
" </ConnectResult>" & @CRLF & _
" </ConnectResponse>" & @CRLF & _
" </soap:Body>" & @CRLF & _
"</soap:Envelope>"
Local $sSubst = "<$1$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