in reply to Removing javascript comments
You might cheat from
Dean Edward's packer
implemented in Perl (and several other languages). It does a great deal more than just strip comments, but you can always run the output back thru a beautifier to reconstruct code layout.
Perl Contrarian & SQL fanboy
Otherwise, I'd suggest looking into Text::Balanced, since parsing JS has many of the same gotchas as parsing Perl, notably, regex syntax that can contain stuff that looks like comments.
Perl Contrarian & SQL fanboy
In Section
Seekers of Perl Wisdom