REBOL Technologies

Needed: A PARSE Common Patterns Page

Carl Sassenrath, CTO
REBOL Technologies
21-Feb-2011 6:16 GMT

Article #0508
Main page || Index || Prior Article [0507] || Next Article [0509] || 13 Comments || Send feedback

Do we have a library of common patterns for parse? If not, I think it would be a useful page to publish.

For example, in R3 here's a parse line that removes all extra lines from a text file (that is, allow only one empty line between paragraphs.)

parse text [some [thru lf [lf some remove lf | none]]]

Here's an a paragraph "unwrap" example. It makes a sequence of adjacent lines into a single long line.

parse doc [
    some [
        not lf thru lf
        some [s: not lf (change back s space) thru lf]
        thru lf

Perhaps you see a slightly better way to write that?

These little parse expressions are really useful, and it'd be great to gather them together onto a single web page so that we don't have to re-invent them each time.

Here's a page where you can post them: Common Parse Patterns.


Updated 17-Oct-2017   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code