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

[REBOL] parsing text???? Re:

From: jelinem1:nationwide at: 25-Aug-2000 8:53

First, unless you know something I don't (very possible) I don't think the following is correct: copy url to {?|"|newline} This will look for the string '?|"|newline' in the file. I think what you really wanted was: copy url [ to "?"| to {"}| to newline] Unfortunately this won't work and is my biggest pet peeve with 'parse. What *I* expect this to do is to look for the first occurrance of "?" OR {"} OR newline, WHICHEVER COMES FIRST. What this actually does is to look for an occurrance of "?" in the file. If the ENTIRE FILE does not contain "?" then it looks for an {"}. Again, if the ENTIRE FILE does not contain {"} then it looks for newline. Is this bevavior useful in anybody's case? I guess it could be, but I haven't run into it yet. If your data does not contain "?" or {"} then you can use your code but you'll have to process a line at a time. Instead of searching the entire file for one of these chars, it will only search the entire current line. Either that, or rewrite your code NOT to use 'parse. NOTE: You might be able to do something with 'charset but I haven't played with enough to know for sure. - Michael Jelinek [akhar--videotron--ca] on 08/24/2000 09:26:10 PM From: [akhar--videotron--ca] on 08/24/2000 09:26 PM Please respond to [list--rebol--com] To: [list--rebol--com] cc: Subject: [REBOL] parsing text???? I have the following text dog.eat.dog.eat.cat.eat.fish dog.eat.dog.eat.cat.eat.fish?but no dog.eat.dog.eat.cat.eat.fish"really dog.eat.dog.eat.cat.eat.fish dog.eat.dog.eat.cat.eat.fish"mmmm dog.eat.dog.eat.cat.eat.fish and am using the following code to parse it: html-code: [ thru newline copy url to {?|"|newline} (append urls url) | copy txt to newline (append text txt) ] page: read %emails.txt parse page [ to newline copy url some html-code (append urls url) ] it freezes I tried many combination but just cannot get the whole txt only parts at the time or parts of the original file. help Stephane