title: Looking for a way to search an html page with javascript
body: <p>what I would like to do is to the html page for a specific string and read in a certain amount of characters after it and present those characters in an anchor tag.</p>
  
  <p>the problem I'm having is figuring out how to search the page for a string everything I've found relates to by tag or id. Also hoping to make it a greasemonkey script for my personal use.</p>
  
  <pre><code>function createlinks(srchstart,srchend){
      var page = document.getElementsByTagName('html')[0].innerHTML;
  
      page = page.substring(srchstart,srchend);
  
      if (page.search("file','http:") != -1)
      {
          var begin = page.search("file','http:") + 7;
          var end = begin + 79;
  
          var link = page.substring(begin,end);
          document.body.innerHTML += '&lt;a href="'+link+'"&gt;LINK&lt;/a&gt; | ';
  
          createlinks(end+1,page.length);
      }       
  };
  </code></pre>
  
  <p>what I came up with unfortunately after finding the links it loops over the document again </p>