Hi, Abdel,

Abdel Belkasri wrote:
> 
> 
> I am kind of new to  REBOL, I wrote these lines to get the latest news from
> www.cnn.com <http://www.cnn.com/> , so far I can get the first line in the
> news table, but I don't know how to make my parse recursive to get all the
> news lines in the table. Here is the code:
> 
> page: read http://www.cnn.com/index.html
> parse page [thru "Other Top News"  copy news-table to "</table>"]
> parse news-table [to "<a"  thru ">"  copy newsline  to "</a>"]
> print newsline
> 

I suggest iteration instead of recursion for this task:

    parse news-table [
        any [
            to "<a" thru ">"
            copy newsline to "</a>" (print newsline)
        ]
        to end
    ]

which, this morning at 10:40 CT (US) gives:

    U.S. hostage survivor seeks justice
    Video
    Colorado fire burns 500 acres an hour
    Video
    Rumsfeld: Iraq 'lying' about biological weapons
    Afghan loya jirga meeting delayed
    Video
    Sunset eclipse hits tonight
    Where to watch
    U.S. ties S. Korea in Cup
    Standings
    == true

Note the addition of TO END after the part that you expect to exhaust
the relevant data.  That allows you to test the true/false result of
PARSE for success or failure.

-jn-
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to