Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
(?:\s|\r)+GO\s*(?:\r|\n)
/
g

Description

Useful for when you need to convert a T-SQL MSSMS Server batch into individual SQL requests by removing the GO between them.

e.g.

Dim SQLBatches As String() = Regex.Split(text, "(?:\s|\r|\n)+GO\s*(?:\r|\n)", RegexOptions.IgnoreCase)

Submitted by SarahC - 10 years ago