I\'m trying to come up with a regular expression to remove comments from an SQL statement.
This regex almost works:
(/\\*([^*]|[\\r\\n]|(\\*+([^*/]|
As you said that the rest of your regex is fine, I focused on the last part. All you need to do is verify that the --
is at the beginning and then make sure it removes all dashes if there are more than 2. The end regex is below
(^[--]+)
The above is just if you want to remove the comment dashes and not the whole line. You can run the below if you do want everything after it to the end of the line, also
(^--.*)