function blah(_x) { console.info(_x.toSource().match(/\/\/\s*@version\s+(.*)\s*\n/i)); } function foobar() {
Is there a way to do this using JavaScript? I want to determine the version number / other attributes in a Greasemonkey script, but as I understand it .toSource() and .toString() .toSource() out comments 1 .
I do not want to wrap the title block in <><![CDATA[ ]><> if I can avoid it, and I want to avoid duplicating the title block outside of the comments, if possible.
Is it possible? Are there alternatives to toSource() / .toString() that will make this possible?
[1] - http://isc.sans.edu/diary.html?storyid=3231
source share