Hello [EMAIL PROTECTED]!
On 05-Giu-00, you wrote:
n> end-of-paragraph: rejoin [{.} newline]
n> ;does not work as I desire (i.e. parsing ONLY by instances of
n> a period followed by a newline character.) Using a charset
When you use PARSE in that way, it splits the string at each
occurrence of any character in the second string; that is, the
first string is split each time a #"." is found, and each time a
newline is found. PARSE will split the string twice if the two
characters are found in sequence.
Anyway, a working solution is:
breakdown-content: func [
"breakdown an e-mail content field into its parts"
msg [object!] "e-mail message"
][
article-info: msg/content
content-parts: copy []
parse/all article-info [
some [copy part thru ".^/" (append content-parts part)]
; this is if you need to keep the last paragraph
; even if it is not ended by . and newline
[end | copy part to end (append content-parts part)]
]
]
Using your example I get:
>> content-parts
== ["^/^/First paragraph here.^/" "^/Then a second paragraph. Another sentence.^/"
"^/A final paragraph.^/" "^/"]
If you want to get rid of the newlines, you can use TRIM/LINES,
changing:
append content-parts part
to:
append content-parts trim/lines part
This way I get:
>> content-parts
== ["First paragraph here." "Then a second paragraph. Another sentence." "A final
paragraph." ""]
Regards,
Gabriele.
--
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/