Just saw this,
I think you might be leaving the realm of what is possible using the methods you used to get to this point. You started out wanting to open all URL's on a page with a time delay between pages, then you wanted to see if a certain link was on the page and it it was follow that and now you want to filter the URL's for certain strings!
What a long strange trip its been (to borrow a quote)!
If I were you I would scrap all this and start over working only in AppleScript and possibly shell scripting. This is common in software development. By starting over fresh you'll take the knowledge you've gained while prototyping and come up with something cleaner in the end.
Had you laid out all the requirements when you first posted I probably would have recommended doing it this way from the start. As a start I would use curl called by using AppleScripts do shell command and then parse the returned web content with Applescript looking for URL's. In AppleScript it will be easy to parse the URL however you wish.
One thing isn't clear to me now that your project has changed was the display of the URL in Safari menat as a means to see the page or only as a way to get the page's content? I think you were only going for the content. If so curl will do nicely.
good luck post back if you need help with the new script. Might be best to start a new thread describing what you've done so far and explaining what you want to do if you need help.