[REBOL] Re: Stuck on Parse - Need Help
From: jonwhispa::googlemail::com at: 5-Aug-2008 20:10
Hi,
The first "thru" would match and the parsing would end and go back to "any"
then matching the first "thru" again and again.
You just needed to remove the "thru"`s and add a "skip" at the end to pass
over any extra text
out-file: to-file "arq.txt"
parse corpo [
any [
"Evento:" copy evt to newline (write/append out-file rejoin
["------" newline evt newline]) |
"Início:" copy ini to newline (write/append out-file rejoin [ini
newline]) |
"Fim:" copy fim to newline (write/append out-file rejoin [fim
newline]) |
skip
]
]
Slightly different version than the others, with a single write.
out-text: ""
output: [ copy temp thru newline (append out-text trim temp) ]
parse/all corpo [ any [ "Evento:" (append out-text "--------^/") output |
Início:
output | "Fim:" output | skip ] ]
;write to-file "arq.txt" out-text
print out-text
--------
Boxe - Preliminares
09/08/2008 02:30
09/08/2008 05:45
--------
Handebol Masculino
09/08/2008 22:00
09/08/2008 23:00
--------
Vôlei de Praia - Masc.
09/08/2008 23:00
10/08/2008 00:00
Jon
2008/8/5 Carlos Lorenz <carlos.lorenz-gmail.com>