in reply to Re: Compressing/Obfuscating a Javascript file
in thread Compressing/Obfuscating a Javascript file

Actually, I think I figured this one out! Change the split regex to:
# do the magic and split into functions my @functions = split /(?=\bfunction\s\w+)/, $data;
What we're doing here is forcing the function to be followed by a name... But what if the function contains a named function? As in:
function InitializeTree (objBlah) { // Set up the event handling. with (objBlah) { test = function test2() { doSomethingHere(); }; } return (0); }
Then I believe that this may again fail... We have to come up with a regex that ignores functions within functions... That's way beyond me... any ideas?