You will not see my regex fault with your examples. My regex will stumble with this sql.
update set bar = bar - 1 ; -- subtraction symbol may disappear.
I expected to see SQL parser solution in this thread, like this
my $p = SQLParser->new(type=>'mysql', sql=>$sql)
or die SQLParser->error();
At first I looked SQL::Parser. It seems quite near for such tasks, but I couldn't find good solution to rip off comments. Do you know such module?