#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?ms).*?(\d+) (\d+).*Errors (\d+) (\d+).*"
Local $sString = "Interface Statistics Received Sent Bytes 30750280 8480324" & @CRLF & _
"" & @CRLF & _
"Unicast packets 44928 43160" & @CRLF & _
"" & @CRLF & _
"Non-unicast packets 0 0" & @CRLF & _
"" & @CRLF & _
"Discards 0 0" & @CRLF & _
"" & @CRLF & _
"Errors 0 0" & @CRLF & _
"" & @CRLF & _
"Unknown protocols 0"
Local $sSubst = " interface statistics\nreceived| \1\nsent | \2\nerrors | \3 \4"
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