in reply to How to split Ada & C files by function/procedure

You should find some useful code at Compressing/Obfuscating a Javascript file including a bit that splits the code into function as you desire. In essence all you need is something like:

# do the magic and split into functions @functions = split /(?=\bfunction\s)/, $data;

In hindsight this split regex should probably be more like:

@functions = split /(?=\n\s*function\s)/, $data;

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print