Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Removing javascript commentsby renodino (Curate) |
on Apr 09, 2008 at 23:39 UTC ( [id://679372]=note: print w/replies, xml ) | Need Help?? |
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. 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
|
|