#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?|^(\d+):()()|\G^()([-+]?\d+)(?![:\d])[ \t]+(.*)|\G^()()()[ \t]*$\R*)\R?"
Local $sString = "6:" & @CRLF & _
"1 my 1st log" & @CRLF & _
"-2 my 2nd log" & @CRLF & _
"" & @CRLF & _
"7:" & @CRLF & _
"-3 my 3rd log" & @CRLF & _
"4 my 4th log" & @CRLF & _
"-5 my 5th log" & @CRLF & _
""
Local $sSubst = "$1\t$2\t$3\r\n"
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