context statement

Description

context

context(i)

The context statement reproduces the context stored from the rule match, or a single character of it, into the output. Use the context statement as much as possible as it is significantly faster than using the index statement.

A single character from the context can be output (on the right-hand side of a rule) or matched (on the left-hand side of a rule) using context(i), which produces the ith character of the stored context.

Examples

any(cons) "W" + any(key) > context index(keyout,3)

"contex" + "t" > context(2) context(6)     c outputs "ox"

Note that although the context(n) statement can be used in the left-hand side of a rule, the context statement cannot.

History

Version 6.0 was the first version to allow context(n) on the left-hand side of a rule. The context(n) construct was introduced in version 6.0.