[REBOL] parse, again...
From: hallvard:ystad:helpinhand at: 1-Nov-2001 14:46
I seem to get something wrong. Look here:
>> html-code: [ copy tag ["<" thru ">"] | copy txt to "<" ]
== [copy tag ["<" thru ">"] | copy txt to "<"]
>> parse/all read http://www.rebol.com/ [to "<" some html-code]
connecting to: www.rebol.com
== false
This returns false because the website ends with some whitespace after the
last tag. I redefine 'html-code and try again:
>> html-code: [ copy tag ["<" thru ">"] | copy txt [to "<" | thru end]]
== [copy tag ["<" thru ">"] | copy txt [to "<" | thru end]]
>> parse/all read http://www.rebol.com/ [to "<" some html-code]
connecting to: www.rebol.com
== false
Hm. Why does this return false? Another try:
>> html-code: [ copy tag ["<" thru ">"] | copy txt to "<" | copy txt thru
end ]
== [copy tag ["<" thru ">"] | copy txt to "<" | copy txt thru end]
>> parse/all read http://www.rebol.com/ [to "<" some html-code]
connecting to: www.rebol.com
== false
Still wrong return value from 'parse. But then, finally:
>> html-code: [ copy tag ["<" thru ">"] | copy txt to "<" | skip]
== [copy tag ["<" thru ">"] | copy txt to "<" | skip]
>> parse/all read http://www.rebol.com/ [to "<" some html-code]
connecting to: www.rebol.com
== true
So I managed, finally. But what if I want to use whatever is written after
the last tag? And especially: what's wrong with my second approach?
I know this probably is basic, and that it's probably been answered a
hundred times already on this mailing list, but I just can't seem to find
the solution (and I _have_ searched, yes).
~H