[REBOL] Parse This
From: hanserik::oakseeker::org at: 12-Feb-2002 5:56
Hiyas all:-)))
I have just downloaded REBOL/view and have startet playing with nntp.r and have stumpled
into some problems.
I have no problems connection to the news-server and getting the subject-lines from the
news-group i'm interrested in. But here comes the problem. I receive them in one huge
block:
>> xresult: insert np [xhdr ["subject " count/2 "-" count/3] from "dk.historie.genealogi"]
== [{37822 Re: Windows95 reinstallation
37823 =?iso-8859-1?Q?S=F8ger?= Volhaus.
37824 Re: DIS-Danmarks formand tavs...
37825 Re: DI...
Please note the curly-thingy before 37822. (sorry, dont know what it's called in english)
Doing a search in the REBOL-list archive on xhdr i came across this from Jeff:
---quote
np: open news://news.somewhere
set [total start end] insert np [count from "alt.test"]
x-mids: rejoin ["Message-ID " start "-" end]
message-ids: insert np [xhdr x-mids from "alt.test" please]
;- please is optional :)
The XHDR command gives you back a big string in a block.
Yes, that is a little odd (XHDR was added at the last
minute just to help aspiring news bot writers, if you want
to know!). The string you will find in the block has the
number of each article followed by the message id. It's
trivial to parse the string and it'll allow you to ask for
individual articles by their message-ids in order. There's
examples of getting articles by message id in the NNTP.r
howto. Using XHDR, you'll have an efficient way of
obtaining true newsgroup ordering with no gaps (for news
severs that support the feature ... If they don't well, you
probably have to fall back on getting all the message
headers in a group if you want to insure total
ordering... that's what Forte' free agent does!!).
---unquote
Jeff says here that it should be trivial to parse the string. It's not trivial for me!
I have no clue what so ever as how to parse the string, so i can sort it by the subject.
I have read the entire chapter on parsing in the core-manual serveral times without getting
any wiser.
Is there a kind soul out there who can help me out please?
Hans-Erik