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

The Hares and The Tortoise

 [1/1] from: pwawood::mango::net::my at: 23-Dec-2004 17:36


A couple of months ago, Lethalman posed a question on how to extract descriptions to href links in a web page. Within hours (if not minutes) a few of the hares of the list (Carl Read, Gabrielle and Sunanda spring to mind) helped him along in the right direction. Well in my tortoise-like way, I've come up with a one-line solution for Lethalman :
>> lethal: {<a href="HYPERLINK
http://bla
>Test</a><a"http://bla">Test</a><a href="HYPERLINK
http://blabla
>Test2</a"http://blabla">Test2</a>}
== {<a href="HYPERLINK "http://bla">Test</a><a"http://bla">Test</a><a href="HYPERLINK "http://blabla">Test2</a"http://blabla">Test2</a>}
>> foreach [desc] extract-web-links/only-descriptions lethal [print desc]
Test Test2 You may have noticed that I had to write a short function extract-web-links to get it down to one line. For what it's worth I've uploaded the function to the Library. Writing the function is part of my snail-paced learning of Rebol. I used it primarily to make sure that I got a grip on series so I avoided use of parse, load/markup and the like. It's probably much longer and much slower than necessary. Peter