urlfilter

Scrape one or more numbers out of a web page's source code.

Note: When looking for a target string to key number-collection off of, be sure that you are looking in the HTML page's source and not just the web page content.

Syntax

num = urlfilter(url, target, numNumbers, direction)

Description

num = urlfilter(url, target) returns the first number in an HTML pages source code following the occurrence of the target string.
num = urlfilter(..., numNumbers) The algorithm will continue grabbing numbers until numNumbers have been grabbed or the end of the file has been reached.
num = urlfilter(..., numNumbers, direction) direction is the direction, either "forward" or "backward" to search from the target string. The default is "forward".

Text inside tag bodies (i.e. anything inside <..> angle braces) is ignored.

Example 1: Tracking the Dow

   urlfilter('http://www.smartmoney.com','S&P 500')

Example 2: Position of Cambridge United in table

   url = 'http://news.bbc.co.uk/sport1/hi/football/eng_conf/conference_table/default.stm';
   tgt = 'Cambridge Utd';
   urlfilter( url, tgt, 1, 'backward' )

Example 3: Test for non-integer

   url = 'http://www.oanda.com/convert/classic?user=printable&exch=NZD&value=1&expr=GBP&date_fmt=us&margin_fixed=0&date=06/12/09&lang=en';
   tgt = 'British Pound';
   urlfilter( url, tgt, 1, 'backward' )