How to write a Java regular expression for a commented SQL code like below?
/*
SELECT * FROM Table1;
-- Comment in comment
Another SQL code
*/
SQL-code
-- One line comment
/**/ -- Yet one comment
/* And yet one comment */
This is my current wrong variant: (--.*)|(/\*(.*\n)*\*/).
I know that comment signatures (--, /**/) can be inside string but for my purpose we can consider so strings as comments, it doesn't matter. The most important to exclude all commented SQL code.