I have the following JavaScript program saved in a file pre.js
:
var pre = readFile("method-help.html");
RegExp.multiline = true;
print(/<pre>((?:.|\s)+)<\/pre>/.exec(pre)[1]);
The contents of method-help.html
is simply the page at http://api.stackoverflow.com/1.0/help/method?method=answers/%7bid%7d. What I'm trying to do is get the JSON code in between the pre
tags. However, when I run the program in Rhino, nothing is printed out and the program does not terminate. The command I use is:
java -jar js.jar pre.js
My Rhino version is 1_7R2.