I\'m trying to come up with a regular expression to remove comments from an SQL statement.
This regex almost works:
(/\\*([^*]|[\\r\\n]|(\\*+([^*/]|
For Node.js, see pg-minify library. It works with PostgreSQL, MS-SQL and MySQL scripts.
It can handle all types of comments, plus compress the resulting SQL to its bare minimum, to optimize what needs to be sent to the server.