Once you have created a new project, or restored an existing GLASS Studio project, you are ready to start adding base pattern components to build out a GLASS custom data type.
Each component consists of a base pattern along with rules and/or parameters that define the expected pattern to match. See Building and Defining GLASS Patterns for more information.
You can add a new component to a project by:
To add your first GLASS base pattern component after creating a new Visual Builder project from scratch:
In the Visual Builder playground, add your first pattern to the project by selecting:
Define the search pattern, options, and patterns rules for the selected RANGE, WORD, or LIST component.
All base pattern components (e.g. WORD, GROUP, RANGE) in a GLASS Studio project must be connected to another component (or group of components).
Two or more components can be joined in:
Both THEN and OR operators can be used together in a GLASS expression.
See THEN and OR Connectors for more information.
To connect a new base pattern component to an existing component:
To add an OR connector, hover over and click
on the + button at the bottom left corner of
the existing component.
You can create a copy of an existing component (or group of components) in the GLASS Studio Visual Builder playground. This allows reuse of components within a data type project which may share similar format with slightly different parameters. For example, with the exception of the serial number length, the format and rules for the serial number in ACME Corporation's regional and worldwide customer ID are similar.
To duplicate an existing component:
You can use the grouping operator ()
to combine multiple
GLASS expressions into a single logical expression, or
to alter the precedence of GLASS operators.
This enables you to develop GLASS expressions that will
attempt to match more complex search patterns.
Operator | Precedence | GLASS Syntax |
---|---|---|
Grouping operator () |
1 | ( <expression 1> <THEN|OR> <expression 2> ) |
THEN Connector | 2 | <expression 1> THEN <expression 2> |
OR Connector | 3 | <expression 1> OR <expression 2> |
Suppose you want to define a basic custom data type to search for ACME Corporation's regional customer ID using only the WORD and RANGE base patterns.
Basic expression to search for valid ccTLD values:
WORD 'AU' OR WORD 'IE' OR WORD 'KR'
Basic expression to search for valid 9-digit serial numbers:
MAP 'INVALID_SERIAL_NUM' 0
RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM'
Basic expression to search for the last check digit:
RANGE DIGIT
Let us consider joining the three basic expressions using RANGE without considering operator precedence.
MAP 'INVALID_SERIAL_NUM' 0
WORD 'AU' OR WORD 'IE' OR WORD 'KR' THEN RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM' THEN RANGE DIGIT
Since THEN has a higher operator precedence than OR, the resulting expression would instruct the GLASS engine to match data patterns that contain either:
AU
, orIE
, orKR
, followed by 9 consecutive digits (000000001
to 999999999
), followed
by a single check digit (0
to 9
.)The grouping operator ()
can be used in the combined
GLASS expression to change the order in which the
expressions are evaluated to correctly search for regional customer ID numbers.
MAP 'INVALID_SERIAL_NUM' 0
(WORD 'AU' OR WORD 'IE' OR WORD 'KR') THEN RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM' THEN RANGE DIGIT
The resulting expression would instruct the GLASS engine to match data patterns that contain:
AU
or IE
or KR
, followed by 9 consecutive digits (000000001
to
999999999
), followed by a single check digit (0
to 9
.)See THEN Example 1 for more information.
To group two components together in GLASS Studio Visual Builder mode:
As you build out a custom GLASS data type, it is likely that you will have multiple component groups. Similar to base patterns, you can copy a component group, delete a component group, add boundary rules, and more.
See Connecting a New Component for more information.
See Duplicating a Component for more information.
In GLASS Studio Visual Builder mode, you can name a component group to more easily identify the various building blocks in your custom GLASS data type.
Similar to the WORD, RANGE and LIST base pattern components, you can define pattern rules for a component group.