REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 6-Feb-2009 Edit History  

REBOL 3 Concepts: Parsing: Skipping Input

Pending Revision

This document was written for R2 and has yet to be revised for R3.

The skip, to, and thru words allow input to be skipped.

Use skip to skip a single character, or use it with a repeat to skip over multiple characters:

["a" skip "b"]
["a" 10 skip "b"]
["a" 1 10 skip]

To skip until a specific character is found, use to:

["a" to "b"]

The previous example starts parsing at a and ends at b but does not include b.

To include the ending character, use thru:

["a" thru "b"]

The previous example starts parsing at a, ends at b, and includes b.

The following rule finds the title of an HTML page and prints it:

page: read
parse page [thru <title> copy text to </title>]
print text
REBOL Technologies

The first thru finds the title tag and goes immediately past it. Next, the input string is copied into a variable called text until the ending tag is found (but it doesn't go past it, or the text would include the tag).

  TOC < Back Next > - WIP Wiki Feedback Admin