you can try:
parse-para: func [ b [file!]][
  a: make block! 200
  copy a []
  parse read b [some [copy c to "^/^/" (append a c) any "^/"] to end ]
  return a
 ] ;end function
 i.e: textfile content:
 "this is first para
  
  this is second para
   
   
  this is third para
  this is third para also "
    parse-para %textfile
  ----the results-----
 ["this is first para" "this is second para " "this is third para ^/ this third para 
also]
 this maybe what you want

---gerry
 
----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 18, 1999 3:18 AM
Subject: [REBOL] Parsing Paragraphs


> Hi Group,
> 
> It's common in text file processing to have to break the file up into
> paragraphs, where a paragraph is defined to be one or more text lines
> followed by one or more blank lines (i.e., two or more newline characters).
> Newline characters within each paragraph must be preserved, and each
> paragraph is to be appended to a block.
> 
> I can easily perform this function with practically no programming in Perl,
> but I need to do it in REBOL, and I'd like to do it with a single 'PARSE
> statement. I've tried literally hundreds of variations of parse rules, but
> the best I've been able to do so far, is to get only the first two
> paragraphs, all the rest disappear somewhere. I haven't found any examples
> in the docs or the program libraries. 
> 
> Can anyone think of a way to parse a file into paragraphs?
> 
> TIA,
> 
> 
> Bernie Schneider
> Systems Analyst
> CIBER, Inc.
> 303-224-4159
> [EMAIL PROTECTED]
> 
> 

Reply via email to