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

REBOL 3 Concepts: Parsing

Pending Revision

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


Parsing splits a sequence of characters or values into smaller parts. It can be used for recognizing characters or values that occur in a specific order. In addition to providing a powerful, readable, and maintainable approach to regular expression pattern matching, parsing enables you to create your own custom languages for specific purposes.

The parse function has the general form:

parse series rules

The series argument is the input that is parsed and can be a string or a block. If the argument is a string, it is parsed by character. If the argument is a block, it is parsed by value.

The rules argument specifies how the series argument is parsed. The rules argument can be a string for simple types of parsing or a block for sophisticated parsing.

The parse function also accepts two refinements: /all and /case. The /all refinement parses all the characters within a string, including all delimiters, such as space, tab, newline, comma, and semicolon. The /case refinement parses a string based on case. When /case is not specified, upper and lower cases are treated the same.

  TOC < Back Next > - WIP Wiki Feedback Admin