ICONICO

Discussion Thread

Data Extractor

Message Thread

For WindowsData Extractor

Extract any data, including email addresses and URLs from your files and webpages.

Posted in the Data Extractor Forum.




Javascript help

Hi,
I'm working on some javascript to extract a couple of pieces of data I need - if there's a phrase present in the page, and the title of that page.

What I have so far will tell me if the page has the phrase "0 results found." However, it would be even better if the script returned every page that has "x results found" (x being any number) except for "0 results found." I'm sure there's a simple way to do this with regex or javascript. I just need some help figuring out how to write it. How would I specify "x results found"? (x being any positive integer except for 0). Thanks!

Here's what I have so far:

DataExtractor.SetColumns(2);
DataExtractor.AddHeader(1, 'Null Result');
DataExtractor.AddHeader(2, 'Title');

var objRE = '0 results found';
var objResults = document.body.outerHTML.match(objRE)

if (objResults) {
for (var i=0; i objResults.length; i++) {
DataExtractor.StartNewResult();
DataExtractor.AddResult(1, objResults[i]);
DataExtractor.AddResult(2, document.title);
}
}
by Laura Wagner on Dec 9 2009 10:19am Reply

Javascript help

Try a regex of "\d results found"
by Nico Westerdale on Dec 9 2009 5:46pm Reply

Our Software Stores

IconicoAccurate Design and Development Software

BitsDuJourDiscount Deal Coupons for Windows and Mac Software Apps

Our Software Services

SoftwareMarketingResourceYou Wrote the Code, Now How do you Sell it?

IcoBlogOur Official Blog

© copyright 2004-2019 Iconico, Inc. Code & Design. All Rights Reserved. Terms & Conditions Privacy Policy Terms of Use