The "magical regex" you seek is really a magical module--Text::Balanced by Damian Conway (TheDamian). extract_codeblock, although designed for Perl and not JavaScript, should probably do the trick.
=cut
--Brent Dax
There is no sig.
Comment on Re: Compressing/Obfuscating Javascript file