#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mi)\([^)]*\)(*SKIP)(*F)|(?<=;)(?=\h*$|\s*\bALTER TABLE\b)"
Local $sString = "$multiSql = "" & @CRLF & _
"ALTER TABLE `my_table` CHANGE `typ` `typ` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0=none; 1=test1; 2=test2; 3=test3';" & @CRLF & _
"" & @CRLF & _
"ALTER TABLE `my_table2`" & @CRLF & _
" ADD `date` varchar(25) COLLATE utf8_czech_ci DEFAULT NULL AFTER `test`;" & @CRLF & _
" " & @CRLF & _
"ALTER TABLE `my_table3` ADD `date` varchar(25) COLLATE utf8_czech_ci DEFAULT NULL AFTER `test`; ALTER TABLE `my_table3` ADD `test2` varchar(25) COLLATE utf8_czech_ci DEFAULT NULL AFTER `date`;" & @CRLF & _
"" & @CRLF & _
"ALTER TABLE `my_table3` CHANGE `test2` `test2` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0=test; 1=test2;';" & @CRLF & _
"";"
Local $sSubst = "\n=================================\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