REBOL 3.0

Post your favorite new PARSE examples

Carl Sassenrath, CTO
REBOL Technologies
23-Dec-2009 18:37 GMT

Article #0302
Main page || Index || Prior Article [0301] || Next Article [0303] || 23 Comments || Send feedback

With so many new parse features in R3, various types of operations should be documented as simple examples.

For example, while working on website revisions I wanted to use R3 to strip out some of the obsolete HTML tags, such as the old FONT markups like:

<FONT SIZE="4" FACE="Arial, Helvetica">About REBOL's Technology</FONT>

And, in fact, all such FONT tags and end tags, regardless of attributes.

Here's the parse code I used. It also shows how to make two passes over the same file because some of the end tags may not be properly paired.

parse page [
    top: while [to "<font" remove thru ">"]
    :top while [to "</font>" remove thru ">"]
]

Notice the use of while rather than some. This is important because remove causes the position index to not advance. See the new note in Parse Summary about this.

Now, I invite you to post your own useful little R3 parse examples. Thanks. We'll collect some of them for use as examples in the parse documentation.

23 Comments

REBOL 3.0
Updated 3-Aug-2020 - Edit - Copyright REBOL Technologies - REBOL.net