Example: Keyword Anchor
Top  Previous  Next

Related example macro: Demo-Extract

Often you just want to extract information connected to a certain word on a web site. In this case, you can use a so-called keyword anchor, which is nothing else than the cunning use of wildcards.

In this example, we would like to extract the information about the appearance of an object. As you can see from the example, this information is always connected with the word "Appeared".

FSBO 4-2-2, $110 KCHAPEL CREEK 111-222-3333
Fort Worth West Sale
First Appeared in the FW Newspaper
FSBO NICE AREA4-2.5-2 2243SF, $139KMSID 222-555-9879
Arlington Southwest Sale
First Appeared in ABC Star
SALE/LEASE condo, 3-2-2 enclosed patio comm. pool SW FW in Villas on the Bluff a gated comm. FSBO $169.5k 555-1111-7997
Condo/Townhome/Apt/DuplexSale
First Appeared in the Star-Telegram


Using the Extraction Wizard, it would suggest a very general extract command, e.g.:

EXTRACT POS=29 TYPE=TXT ATTR=<TD>*

While this might work, it is sensitive to small changes in the web page layout. If another table cell is inserted before this one, you will extract the wrong data. In this case, however, you can easily fine tune your extraction to make it more robust against web page changes using the keyword "Appeared" and wildcards:

EXTRACT POS=1 TYPE=TXT ATTR=<TD>*Appeared* 

Remeber to reset the
POS attribute since, with the "Appeared" part, it is the first occurence.



Page URL http://www.iopus.com/imacros/help/extract_example_keyword_anchor.htm