Hello Gentle Reader,
Using the simple idea of Regular Expressions, I have worked out the way to
extract the ratio of the white space
in the JS script to the script length.
Apart from this I was planning, as you know, on finding the %of comments in
the JS code. I have written the attached regular expression for stripping
the comment from the string considering the fact that:
1. Single line comments in JS either follow // or are within /* */
2. these patterns don't work if are enclosed in " "
3. multi line comments are bounded by /* */
The expression I worked out doesnot function well in case /* or */ are
immediately followed by the string patterns or if there is a different
pattern within the construct with special chars or sequence of alphabets and
Then after properly thinking on this idea of ratio of comment strings to
file length, I find that it not very useful. So may I drop it for a while? I
think it is better to concentrate on extracting the following features:
1. length of argument in the unescape(), eval() function.
2. string passed to the document.write or document.writeln method
3. length of variable names.
Apart from this JS oriented approach, I also came across the use of Meta tag
of html for redirection of pages. I will get a proper idea on this and find
how we could put it to use.
Awaiting your comments.