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

[REBOL] Re: Parse This

From: joel:neely:fedex at: 12-Feb-2002 7:19

Hi, Hans-Erik, Hans-Erik wrote:
> 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... >
...
> Jeff says here that it should be trivial to parse the string. >
Hope this helps!
>> blort: {this is a very long string
{ broken into several lines { delimited by only a newline { which can be parsed easily { with the following trick:} == {this is a very long string broken into several lines delimited by only a newline which can be parsed easily with the following ...
>> parse/all blort "^/"
== ["this is a very long string" "broken into several lines" "delimited by only a newline" "which can be parsed easily" "with the f...
>> nbr: 0 foreach element parse/all blort "^/" [
[ nbr: nbr + 1 [ print [nbr element] [ ] 1 this is a very long string 2 broken into several lines 3 delimited by only a newline 4 which can be parsed easily 5 with the following trick: -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;