Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgently need Regular Expression to strip out T-SQL comments

Status
Not open for further replies.

Spork52

Programmer
Nov 20, 2007
134
US
Urgently need a VBScript Regex to strip out T-SQL comments (in what follows all characters are literals).

It would find multiline T-SQL comments, which is anything between

/*

and

*/

inclusive, but not greedy.

And between

--

and a new line or end of line.

This is for an ad hoc solution to thwart a particularly nasty kind of SQL Injection attack. More details on that here:

 
Cancel that. Figured it out (I hope). Is there a way to edit posts? Here's the regex:

/\*[^\*/]+\*/|--.+| |\n

Strips out T-SQL comments as well as spaces and new lines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top