LIST Operator

Overview of the LIST Operator

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.

GLASS Studio LIST Component

Defining a LIST

Using the GROUP (LIST) operator, you can search for any entry that is defined in the selected MAP namespace(s).

The generic GLASS syntax for GROUP and MAP is:

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

Using the GROUP operator is equivalent to using multiple WORD / OR operators in a single expression.

1 MAP 'FIRST_NAMES' 'David', 'James', 'Michael', 'William'
2 GROUP 'FIRST_NAMES'
3 WORD 'David' OR WORD 'James' OR WORD 'Michael' OR WORD 'William'

For example, the expressions in Line 1 and Line 2 is equivalent to Line 3 and will search for data that contains David, James, Michael, or William.

LIST Example 1

ACME Corporation defines a MAP namespace for the accepted ccTLD values (AU, IE, KR, SG, UK, US) in a regional customer ID and searches for these values by referencing the namespace in the GROUP operator.

MAP 'ACME_CUST_ID_CCTLD' 'AU', 'IE', 'KR', 'SG', 'UK', 'US'
GROUP 'ACME_CUST_ID_CCTLD'

All the following lines will be returned as match locations by the GLASS pattern matching engine:

1 Customer ID: US1003992835
2 Client data: AU2648761235
3 John Doe|SG0000137492|+65 9876 5432|john.doe@example.com

The equivalent configuration in GLASS Studio Visual Builder mode is:

  • Data type component: LIST (GROUP)
    • Data pattern to search for (+ Create Map):
      • MAP Label: ACME_CUST_ID_CCTLD
      • MAP Entries: 'AU', 'IE', 'KR', 'SG', 'UK', 'US'

Using Multiple Namespaces in a LIST

There may be instances where you want to maintain separate MAP namespaces for use across multiple GLASS data types.

For example, instead of creating a single namespace that contains the names of all employees, it may be easier to manage separate namespaces for employee names across different worksites (e.g. IE_NAMES, SG_NAMES, US_NAMES).

In such instances, you can use the COPY operator to copy the contents from one namespace into another, and still refer to a single MAP namespace from the GROUP operator.

MAP 'IE_NAMES' 'Cara', 'Grainne', 'Shannon'
MAP 'SG_NAMES' 'Charlotte', 'Evelyn', 'Layla', 'Sarah'
MAP 'US_NAMES' 'Ava', 'Gabrielle', 'Ruby', 'Sophie'
MAP 'GLOBAL_NAMES' COPY 'IE_NAMES', COPY 'SG_NAMES', COPY 'US_NAMES'
GROUP 'GLOBAL_NAMES'

See MAP Namespace - Adding or Removing Keys in a MAP Namespace for more information.

GLASS Studio Visual Builder Mode

When multiple namespaces are selected for the LIST (GROUP) component in GLASS Studio Visual Builder mode, GLASS Studio automatically creates a new namespace with a unique label and copies the selected namespaces to the new namespace using the COPY operator.

GLASS Studio Multiple Namespaces for LIST Component

Matching a LIST

Matches are not limited by traditional word boundaries (e.g. whitespaces, new lines) and can happen anywhere in a string or data stream, unless pattern boundaries are defined.

LIST Example 2

You write a simple GLASS expression to search for the accepted ccTLD values (AU, IE, KR, SG, UK, US) in a regional customer ID:

MAP 'ACME_CUST_ID_CCTLD' 'AU', 'IE', 'KR', 'SG', 'UK', 'US'
GROUP 'ACME_CUST_ID_CCTLD'

As no pattern boundaries are defined, all the following lines will be returned as match locations by the GLASS pattern matching engine:

1 Customer ID: US1003992835
2 Country: AUSTRALIA
3 Country: AUSTRALIA

The equivalent configuration in GLASS Studio Visual Builder mode is:

  • Data type component: LIST (GROUP)
    • Data pattern to search for (+ Create Map):
      • MAP Label: ACME_CUST_ID_CCTLD
      • MAP Entries: 'AU', 'IE', 'KR', 'SG', 'UK', 'US'

Case Sensitivity of a LIST

The NOCASE (No Case) option determines if the GLASS pattern matching engine treats uppercase and lowercase characters as distinct (case sensitive) or equal (case-insensitive) characters.

GLASS Studio WORD Component Case Sensitivity option

By default, GLASS patterns are case sensitive. This means uppercase and lowercase characters are distinct characters. For example, lowercase a and uppercase A are treated as different characters by the GLASS pattern matching engine.

The GLASS syntax to define a case-sensitive GROUP is:

GROUP '<list of data patterns>'

If the NOCASE (No Case) option is specified or checked in GLASS Studio Visual Builder mode, uppercase and lowercase characters are equal. For example, lowercase a and uppercase A are treated as the same character by the GLASS pattern matching engine.

The GLASS syntax to define a case-insensitive GROUP is:

GROUP NOCASE '<list of data patterns>'

In GLASS Studio Visual Builder mode, you can specify the NOCASE option for a GROUP at a global namespace level using the MAP operator.

See MAP namespace for more information.

LIST Example 3

MAP 'IE_NAMES' 'Charlie', 'Conor', 'Daniel', 'Jack', 'Liam', 'Noah'
GROUP NOCASE 'IE_NAMES'

Using the GLASS expression in Example 3, all the following lines will be returned as match locations by the GLASS pattern matching engine:

1 Employee Name: CONOR
2 jack | 20-Nov-1990 | jack@example.com
3 My NaMe Is LiAm.

Applying the NOCASE option globally to the MAP namespace will also return Line 1, Line 2, and Line 3 as match locations:

MAP NOCASE 'IE_NAMES' 'Charlie', 'Conor', 'Daniel', 'Jack', 'Liam', 'Noah'
GROUP 'IE_NAMES'

The equivalent configuration in GLASS Studio Visual Builder mode is:

  • MAP Name: 'IE_NAMES'
  • MAP Entries: 'Charlie', 'Conor', 'Daniel', 'Jack', 'Liam', 'Noah'
  • MAP No Case option: Checked
  • Data type component: LIST (GROUP)
    • List namespace selection: 'IE_NAMES'

Decomposing a LIST

If the DECOMPOSE (Decompose) option is specified or checked, the GLASS pattern matching engine matches the search pattern both in its original form and normalized (ASCII) form, where applicable.

This is useful when searching for data patterns that contain language-specific accents or diacritics (e.g. Zürich).

GLASS Studio WORD Component Decompose option

The GLASS syntax to decompose a GROUP is:

GROUP DECOMPOSE '<list of data patterns>'

In GLASS Studio Visual Builder mode, you can specify the DECOMPOSE option for a GROUP at a global namespace level using the MAP operator.

See MAP namespace for more information.

LIST Example 4

MAP 'BELGIAN_NAMES' 'aäron', 'angélique', 'björn', 'frédéric', 'gisèle', 'jean-luc'
GROUP NOCASE DECOMPOSE 'BELGIAN_NAMES'

Using the GLASS expression in Example 4, all the following lines will be returned as match locations by the GLASS pattern matching engine:

1 Employee Name: Angélique
2 GISELE | 20-Nov-1990 | GISELE@EXAMPLE.COM
3 My NaMe Is GiSèLe.

Applying the DECOMPOSE and NOCASE option globally to the MAP namespace will also return Line 1, Line 2, and Line 3 as match locations:

MAP NOCASE DECOMPOSE 'BELGIAN_NAMES' 'aäron', 'angélique', 'björn', 'frédéric', 'gisèle', 'jean-luc'
GROUP 'BELGIAN_NAMES'

The equivalent configuration in GLASS Studio Visual Builder mode is:

  • MAP Name: 'BELGIAN_NAMES'
  • MAP Entries: 'aäron', 'angélique', 'björn', 'frédéric', 'gisèle', 'jean-luc'
  • MAP No Case (NOCASE) option: Checked
  • MAP Decompose (DECOMPOSE) option: Checked
  • Data type component: LIST (GROUP)
    • List namespace selection: 'IE_NAMES'

Pattern Rules for a LIST

You can define the following pattern rules when searching for elements defined in the MAP namespace(s) using the LIST (GROUP) component:

  1. BOUND

GLASS Studio Define Pattern Rules for LIST Component

Boundary Rules for a LIST

The BOUND precision rule lets you define the list possible characters that the must be found before (BOUND LEFT), after (BOUND RIGHT), or surrounding (BOUND) any data pattern defined in a namespace for a GROUP for it to be a match.

See BOUND Rule for more information.

Adding a LIST Component

To search for any element from the selected MAP namespace(s) using the LIST (GROUP) operator in GLASS Studio Visual Builder Mode:

  1. Add a LIST component to the GLASS Studio project.
  2. Define the namespace(s) to be referenced by the GROUP operator by:
    • Clicking on Create Map and selecting the newly added MAP namespace, or
    • Selecting an existing MAP namespace from the Select Map(s) to add to LIST pane.

    Selected namespaces will be added to the Listed Map(s) pane. See MAP Namespace for more information.

  3. (Optional) Click to remove a selected MAP namespace from the GROUP rule.
  4. (Optional) Specify additional criteria that must be fulfilled for the search pattern to be returned as a match. See Pattern Rules for a LIST for more information.

Managing the LIST Component

To edit the GROUP component:

  1. Left click anywhere in the component to open the base pattern form.
  2. Add (check) / remove (uncheck) namespaces or edit the pattern rules, and click Close.

To duplicate the GROUP component:

  1. Right click anywhere in the component to open the context menu and click on Copy.
  2. Go to the component which you want to join the duplicated GROUP component to.
  3. Right click anywhere in the component to open the context menu and click on:
    • Paste > As Then to join connect the duplicated component in series.
    • Paste > As Or to join connect the duplicated component in parallel.

See Duplicating a Component for more information.

To remove the GROUP component along with the corresponding GLASS code:

  1. Right click anywhere in the component to open the context menu and click on Delete, or
    Left click anywhere in the component to open the base pattern form and click on Delete.
  2. In the dialog box, click Delete to confirm the deletion, or click Cancel to cancel the operation. This action can be undone by clicking on the GLASS Studio main menu button > Undo.

To change from GROUP to another base pattern:

  1. Left click anywhere in the component to open the base pattern form.
  2. Click on LIST at the top bar and select a different base pattern.
    GLASS Studio Change LIST Base Pattern