November 14, 2018 at 11:58 pm
Comments posted to this topic are about the item T-SQL Decommenter Part II
November 15, 2018 at 12:03 am
Or using powershell and regex
([regex]"(?im)--.*?$").replace(([regex]"(?s)\/\*.*?\*\/").replace($sql, ""), "")
November 17, 2018 at 10:47 am
will 58232 - Thursday, November 15, 2018 12:03 AMOr using powershell and regex([regex]"(?im)--.*?$").replace(([regex]"(?s)\/\*.*?\*\/").replace($sql, ""), "")
That will work much of the time, but here are a couple of examples that will get mangled:
([regex]"(?im)--.*?$").replace(([regex]"(?s)\/\*.*?\*\/").replace("SELECT '-- in string'", ""), "")
([regex]"(?im)--.*?$").replace(([regex]"(?s)\/\*.*?\*\/").replace("/*SELECT /*'Nested'*/'Commented'`r`n*/`r`nSELECT 'Uncommented'", ""), "")
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply