fork download
  1. / Request a homepage and extract its title by regular expression
  2. url = "http://d...content-available-to-author-only...x.com/u/37805589/WebTA/web_hw7.html";
  3. xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  4. xmlHttp.open("GET", url, false, "");
  5. xmlHttp.send(); // Send the request
  6. contents = xmlHttp.responseText; // Get the contents
  7. //WScript.Echo(contents); // Print the contents if necessary
  8.  
  9. // Use regression expression to extract the title
  10. //re = new RegExp("<title>(.*)<\/title>", "gi");
  11. //while(1)
  12. {
  13. re = /^<A(.*?)<\/A>/gi;
  14. // get <xmp> string
  15. x_re= /<xmp><A(.*?)<\/A><\/xmp>/gi;
  16.  
  17. var arr=[];
  18. arr=contents.match(re);
  19. re2=/^<\s*A\s+HREF\s*=\s*"?(.*?)"?\s*>(.*?)<\s*\/\s*A\s*>/i;
  20.  
  21. // if(arr!=null)
  22. for(i=0;i<arr.length;i++)
  23. {
  24. //WScript.Echo("index = " + index);
  25. //re.exec(arr[i]);
  26. re2.exec(arr[i]);
  27. //WScript.Echo(" text= " + RegExp.$1);
  28. // rtemove <...>
  29. str=RegExp.$2;
  30. str=str.replace(/<.>/g,"");
  31. str=str.replace(/<\/.>/g,"");
  32. //str=str.replace("/<xmp>/","");
  33. WScript.Echo(" text= " + str);
  34. }
  35. }
Runtime error #stdin #stdout 0.26s 213120KB
stdin
Standard input is empty
stdout
Standard output is empty