By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

Need RegEx help

P: n/a
I need to parse a string, which contains SQL commands, for the batch
terminator ("GO"). I came up with "\s[Gg][Oo]\s" which seems to work as
long as there isn't a "GO" in any comments. I have no idea how to tell
RegEx to ignore "GO" if it's either in a line comment (--) or within a block
comment (/* */). Any RegEx gurus know how to do this?

For example, the following "GO"s should be ignored
select * from Customers
-- go
select * from Customers
/*
go
*/
select * from Customers
But this should return a match:
select * from Customers
go
select * from Customers
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.