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

[REBOL] Re: Parse versus Regular Expressions

From: g:santilli:tiscalinet:it at: 5-Apr-2003 11:13

Hi Joel, On Saturday, April 5, 2003, 1:51:32 AM, you wrote: JN> Thanks in advance to anyone who offers PARSE solutions! line-rule: [copy leading 6 digit copy body 66 skip copy trailing 8 digit] digit: charset "0123456789" last-leading: last-trailing: 0 buffer: "" foreach line read/lines %test.txt [ if parse/all line line-rule [ leading: to integer! leading trailing: to integer! trailing either any [leading <= last-leading trailing < last-trailing] [ print ["ERROR:" line] ] [ last-leading: leading last-trailing: trailing if #"*" <> pick trim body 1 [ insert insert tail buffer " " body ] if all [not empty? buffer #"." = last buffer] [ print trim buffer clear buffer ] ] ] ] Which gives: This is a sentence. So is this. ERROR: 000006* but this won't because of sequence order 20030101 The last sentence. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r