#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)(?:\s*|\r)+GO(\s*);*\s*(?:\r|\n)"
Local $sString = "GO;" & @CRLF & _
"[11-02-2016 08:14] Rene Krone: " & @CRLF & _
"/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/" & @CRLF & _
"BEGIN TRANSACTION" & @CRLF & _
"SET QUOTED_IDENTIFIER ON" & @CRLF & _
"SET ARITHABORT ON" & @CRLF & _
"SET NUMERIC_ROUNDABORT OFF" & @CRLF & _
"SET CONCAT_NULL_YIELDS_NULL ON" & @CRLF & _
"SET ANSI_NULLS ON" & @CRLF & _
"SET ANSI_PADDING ON" & @CRLF & _
"SET ANSI_WARNINGS ON" & @CRLF & _
"COMMIT" & @CRLF & _
"BEGIN TRANSACTION" & @CRLF & _
"Go ;" & @CRLF & _
"ALTER TABLE dbo.ResultCodes ADD" & @CRLF & _
" ShortDescription nvarchar(50) NULL," & @CRLF & _
" EnglishDescription nvarchar(100) NULL" & @CRLF & _
" gO;" & @CRLF & _
"ALTER TABLE dbo.ResultCodes SET (LOCK_ESCALATION = TABLE) GO PRINT 'PLEASE GO ; '" & @CRLF & _
"GO" & @CRLF & _
"COMMIT " & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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