Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Recursive Parse

From: joel:neely:fedex at: 10-Jun-2002 10:40

Hi, Abdel, Abdel Belkasri wrote:
> > I am kind of new to REBOL, I wrote these lines to get the latest news from > <> , 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 > 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-