KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to come up with a regular expression to remove comments from an SQL statement. This regex almost works: (/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|'(?:[^']|'')*'|(--.*) Excepth that last part doesn't handle "--" comments very well. The problem is handling SQL strings, delimited with ''. For example, if i have SELECT ' -- Hello -- ' FROM DUAL It shouldn't match, but it's matching. This is in ASP/VBscript. I've thought about matching right-to-left but i don't think the VBScript's regex engine supports it. Also tried fiddling with negative lookbehind but the results weren't good.
Tags (comma-separated)
Save Edits
Cancel