#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)Executed\s+as\s+user:\s+[\w\\]+\.|\[SQLSTATE \d+\] \(\w+ \d+\)\s*\.?"
Local $sString = "Executed as user: Company\SA_SQLA. Warning: Null value is eliminated by an aggregate or other SET operation. [SQLSTATE 01003] (Message 8153) Warning: Null value is eliminated by an aggregate or other SET operation. [SQLSTATE 01003] (Message 8153) Warning: Null value is eliminated by an aggregate or other SET operation. [SQLSTATE 01003] (Message 8153) Warning: Null value is eliminated by an aggregate or other SET operation. [SQLSTATE 01003] (Message 8153) The OLE DB provider "MSOLEDBSQL" for linked server "linked_server" does not contain the table ""databasename"."dbo"."table"". The table either does not exist or the current user does not have permissions on that table. [SQLSTATE 42000] (Error 7314) 2023-04-04 08:19:05.797: Fetching data, please wait... [SQLSTATE 01000] (Error 50000) 2023-04-04 08:19:05.797: Fetching data for Mar 4 2023 8:19AM, please wait... [SQLSTATE 01000] (Error 50000) 2023-04-04 08:20:07.813: Fetching data done! Starting Calculation, please wait... [SQLSTATE 01000] (Error 50000) 2023-04-04 08:20:22.657: Calculation Done! forwarding data, please wait... [SQLSTATE 01000] (Error 50000). The step failed."
Local $sSubst = "$0\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