Product Site

Chapter 9. Parsing

9.1. Simple Templates for Parsing into Words
9.1.1. Message Term Assignments
9.1.2. The Period as a Placeholder
9.2. Templates Containing String Patterns
9.3. Templates Containing Positional (Numeric) Patterns
9.3.1. Combining Patterns and Parsing into Words
9.4. Parsing with Variable Patterns
9.5. Using UPPER, LOWER, and CASELESS
9.6. Parsing Instructions Summary
9.7. Parsing Instructions Examples
9.8. Advanced Topics in Parsing
9.8.1. Parsing Several Strings
9.8.2. Combining String and Positional Patterns
9.8.3. Conceptual Overview of Parsing

The parsing instructions are ARG, PARSE, and PULL.

The data to be parsed is a source string. Parsing splits the data in a source string and assigns pieces of it to the variables named in a template. A template is a model specifying how to split the source string. The simplest kind of template consists of a list of variable names. Here is an example:
variable1 variable2 variable3

This kind of template parses the source string into whitespace-delimited words. More complicated templates contain patterns in addition to variable names:
String patterns

Match the characters in the source string to specify where it is to be split. (See Section 9.2, “Templates Containing String Patterns” for details.)
Positional patterns

Indicate the character positions at which the source string is to be split. (See Section 9.3, “Templates Containing Positional (Numeric) Patterns” for details.)

Parsing is essentially a two-step process:
  1. Parse the source string into appropriate substrings using patterns.
  2. Parse each substring into words.