Quick Reference

The following is a list of all the keyword, operators, rules etc… that are available in the GLASS language.

Operator / Keyword Description & Example Usage
WORD

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Use the WORD operator to search for a specific data pattern. A location will be returned as a match if the data pattern is found in the location.

Example Usage

WORD [NOCASE] [DECOMPOSE] '<data pattern>'

RANGE

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Use the RANGE operator to search for N number (TIMES) of characters from a specific set of characters. A location will be marked as a match if N characters from the defined range are found in the location.

Example Usage

RANGE NOCASE '<custom range of characters>'

GROUP

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Use the GROUP (LIST) operator to search for any element from a set of words (or data patterns) that are defined in a MAP namespace. A location will be marked as a match if any of the data patterns defined in the namespace is found in the location.

Example Usage

MAP [NOCASE|DECOMPOSE] '<namespace>' [NOCASE|DECOMPOSE] '<entry 1>', [NOCASE|DECOMPOSE] '<entry 2>', ..., [NOCASE|DECOMPOSE] '<entry N>'
GROUP [NOCASE|DECOMPOSE] '<namespace>'

THEN and OR

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

All base patterns (e.g. WORD, GROUP, RANGE) in a GLASS data type must be connected to another component (or group of components). Two or more components can be joined in:

  • Series with a THEN connector so that the data patterns and the corresponding rules defined by the connector must be matched consecutively, or
  • Parallel with an OR connector so that the data patterns and the corresponding rules defined by either of the connectors may be matched.
Both THEN and OR operators can be used together in a GLASS expression.

Example Usage

[(]<search pattern or expression> THEN <search pattern or expression>[)]
(<search pattern or expression> OR <search pattern or expression>)

ALIAS and REFER

Full syntax support in GLASS Studio Code Editor mode

Use the ALIAS operator to create a set of reusable GLASS expressions that can be referenced in multiple places using the REFER operator.

Example Usage

ALIAS '<label>' <expression>
REFER '<label>'

MAP

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

In GLASS, namespaces are defined with the MAP operator and have the following properties:

  • Namespaces are unique.
  • Namespaces can be referenced anywhere in a GLASS data type definition. For example, use namespaces in search patterns (GROUP), pattern rules (RANGE with REQUIRE / EXCLUDE), or contextual keywords (CONTEXT).
  • Namespaces are reusable blocks that can be referenced more than once in a GLASS data type.

Example Usage

MAP [NOCASE|DECOMPOSE] '<namespace>' [NOCASE|DECOMPOSE] '<key 1>', [NOCASE|DECOMPOSE] '<key 2>', ..., [NOCASE|DECOMPOSE] '<key N>'

GROUP '<namespace>'
RANGE '<range of characters>' [TIMES <integer>[-<integer>]] [EXCLUDE|REQUIRE '<namespace>']

BOUND

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Pattern boundaries let you define the content that the must be found before (BOUND LEFT), after (BOUND RIGHT), or surrounding (BOUND) a search pattern (WORD, RANGE, or GROUP) for it to be a match.

Example Usage

<search pattern> BOUND [LEFT|RIGHT] <boundary pattern>

REQUIRE

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Applying a REQUIRE rule to a base pattern instructs the GLASS engine to report a match only if the base pattern is explicitly represented in the selected [MAP] namespace(s). [MAP]: ../reference/map.html

Example Usage

<search pattern> REQUIRE [STRIP|TRIM] <namespace>

EXCLUDE

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Applying an EXCLUDE rule to a base pattern instructs the GLASS engine to exclude a pattern from being reported as a match if it is represented in the selected [MAP] namespace(s). [MAP]: ../reference/map.html

Example Usage

<search pattern> EXCLUDE [STRIP|TRIM] <namespace>

CHECK

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Use the CHECK rule to instruct the GLASS engine to run each potential match through a specific algorithm as a form of validation to reduce or eliminate false positive matches. A location is only returned as a match if it passes the checksum module that is applied to the GLASS expression(s).

Example Usage

<search pattern> CHECK '<checksum module>'

CONTEXT and APPLY

Full syntax support in GLASS Studio Code Editor mode Supported in GLASS Studio Visual Builder mode

Contextual matching (CONTEXT and APPLY) is an efficient way to specify a set of contextual keywords which when present, determines whether the GLASS engine reports or ignores a potential match.

Example Usage

MAP [NOCASE|DECOMPOSE] '<namespace>' [NOCASE|DECOMPOSE] '<key 1>', [NOCASE|DECOMPOSE] '<key 2>', ..., [NOCASE|DECOMPOSE] '<key N>'
CONTEXT '<context namespace>' [BEFORE|AFTER|AROUND] [REQUIRE|DENY] '<namespace>' [WITHIN <integer> <range>]
CONTEXT '<context namespace>' [BEFORE|AFTER|AROUND] [REQUIRE|DENY] '<namespace>' [WITHIN <integer> <range>]

<search pattern> APPLY '<context namespace>'

DECLARE and CALL

Full syntax support in GLASS Studio Code Editor mode

Use the DECLARE operator to create parameterized pieces of GLASS code that can form complex, context-specific expressions from simple and easy-to-understand base expressions. These parameterized blocks of code can be referenced in multiple places using the CALL operator.

Example Usage

DECLARE '<label>', ${param1}, ${param2}, , ${paramN} {
  <expression>
}

CALL '<label>', param1, param2, , paramN

RANK and SCORE

Full syntax support in GLASS Studio Code Editor mode

The GLASS language has two operators that allow the expression writer to influence the score for the rule: RANK and SCORE. Both RANK and SCORE operators work with the concept of namespaces. These namespaces are distinct from the mapping operator namespaces (MAP) and are used to define a name for a set of scores.

Example Usage

SCORE '<namespace>' <integer> <BEFORE|AFTER|INSIDE> <expression or pattern>

<expression or pattern> RANK <score modifier> ['<namespace>']

LABEL

Full syntax support in GLASS Studio Code Editor mode

One or more expressions can form a rule that determines whether the input data matches or not. Whenever a rule generates a match, the engine will report this match. When this reporting happens, it is helpful to identify what rule has matched. This can be done with the LABEL operator.

Example Usage

LABEL '<literal>'
<expressions>

MARK

Full syntax support in GLASS Studio Code Editor mode

The MARK operator will instruct the engine to report only the <left pattern> that matched; the <right pattern> that matched will not be reported.

Example Usage

<left pattern> MARK <right pattern>
<left pattern> MARK [MINIMAL]