[REBOL] using parse to remove tags from html string
From: mgh520:yaho:o at: 10-Aug-2001 12:36
Hopefully this is an easy one for somone out there. I'm trying to remove all tags from
a string in the simplest way possible.
The following example seems to be very close--it removes the first tag but doesn't continue.
>> test: "<Name>Homer</Name>"
== "<Name>Homer</Name>"
>> parse test [any [to "<" begin: thru ">" ending: (remove/part begin ending)] to end]
== true
>> print test
Homer</Name>
this next one prints all indexes of tags, and it works correctly, leading me to believe
that the problem with the above
example comes into play once you start to modify the original string.
>> test: "<Name>Homer</Name>"
== "<Name>Homer</Name>"
>> parse test [any [to "<" begin: thru ">" ending: (print index? begin print index? ending)]t
o end]
1
7
12
19
== true
Thanks for any suggestions you may have.
mike
p.s. are my messages coming through with extra newlines? It looks truly awful on escribe.