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).
For example, apply the LUHNCHKSUM checksum module to validate the check digit for potential primary account number (PAN) matches.
The generic GLASS syntax for CHECK is:
<search pattern> CHECK '<checksum module>'
See Supported Check Modules for a list of common checksum modules that are built-in and ready to use in your custom data types.
Your organization issues American Express (AMEX) corporate cards for employees who require it.
You develop a custom GLASS data type that searches for AMEX card numbers that are stored in plain text across your organization's storage locations, with the following requirements:
34
or 37
.-
, whitespaces
) and cannot
be bounded by digits.MAP 'AMEX_PREFIX' 34, 37
(GROUP 'AMEX_PREFIX' THEN RANGE DIGIT TIMES 13) \
CHECK 'LUHNCHKSUM' BOUND NONDIGIT
Based on the GLASS expression above, the GLASS pattern matching engine will return Line 1 and Line 2 as match locations:
1 | CC: 371449635398431 |
2 | John Doe|345678901234564|john.doe@example.com |
3 | SHA-1 cf23df2207d9937144963539843135e633b65d94 |
4 | CC: 345678901234569 |
Line 3 and Line 4 will not be returned as match locations.
9
and 3
) on both sides.9
).The equivalent configuration in GLASS Studio Visual Builder mode is:
ACME Corporation's regional customer ID is a 12-digit string
that starts with
a supported 2-character ccTLD (<ccTLD>
),
followed by a 9-digit serial number (<9-digit serial number>
), and
a single check digit (<check digit>
) that must pass the MOD-10 checksum
algorithm adopted for use in Machine Readable Travel Documents (MRTDs).
To search for the regional customer ID, you write a custom data type as follows:
MAP NOCASE 'ACME_CUST_ID_CCTLD' 'AU', 'IE', 'KR', 'SG', 'UK', 'US'
MAP 'INVALID_SERIAL_NUM' 0
( \
GROUP 'ACME_CUST_ID_CCTLD' THEN \
RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM' THEN \
RANGE DIGIT \
) CHECK 'PASSPORTMOD10' BOUND NONALNUM
The equivalent configuration in GLASS Studio Visual Builder mode is:
The following is a list of all built-in checksum modules that are defined in the GLASS language and can be applied to your custom GLASS expressions.
Checksum Module | Description |
---|---|
CHECKACCT | Verifies that the data pattern meets the following criteria:
|
CHECKLICENSE | Verifies that the data pattern meets the following criteria:
|
IBANMOD97 | Verifies that the data pattern passes the International Bank Account Number (IBAN) MOD-97-10 checksum. |
ISO8583PAN | Verifies that the data pattern passes the ISO 8583 length indicator check and the Luhn formula for MOD-10 checksum. |
LUHNCHKSUM | Verifies that the data pattern passes the Luhn formula for MOD-10 checksum. This checksum is mainly used for validating the personal account number (PAN) of an identification card (e.g. credit cards). |
MAXZEROES_3 | Verifies that the data pattern contains at most three ASCII digit zeroes (0). |
MAXZEROES_4 | Verifies that the data pattern contains at most four ASCII digit zeroes (0). |
MAXZEROES_5 | Verifies that the data pattern contains at most five ASCII digit zeroes (0). |
MINDIGITS_2 | Verifies that the data pattern contains at least two ASCII digit (0-9). |
MINDIGITS_4 | Verifies that the data pattern contains at least four ASCII digit (0-9). |
MINDIGITS_6 | Verifies that the data pattern contains at least six ASCII digit (0-9). |
MINMAXDIGITS_1_4 | Verifies that the data pattern contains between 1 to 4 ASCII digits (0-9). |
MINMAXDIGITS_4_8 | Verifies that the data pattern contains between 4 to 8 ASCII digits (0-9). |
MINZEROES_1 | Verifies that the data pattern contains at least one ASCII digit zero (0). |
PASSPORTMOD10 | Verifies that the data pattern passes the MOD-10 checksum algorithm adopted for use in Machine Readable Travel Documents (MRTDs). |
SAMECASE | Verifies that all letters in the data pattern are either fully uppercase (A-Z) or fully lowercase (a-z) characters. |
SEPARATOR | Verifies that the separator defined in the preceding
RANGE:
If X represents a valid separator character, the separator in the data pattern must satisfy any of the following conditions:
|
UTF8 | Verifies that the data pattern is a valid UTF-8 code unit sequence. |
VALID_DATE_DDMMYY | Verifies that the data pattern given in the short
DDMMYY format
is a valid date within the 1901-01-01 to 2099-12-31 date range.
|
VALID_DATE_YYMMDD | Verifies that the data pattern given in the short
YYMMDD format
is a valid date within the 1901-01-01 to 2099-12-31 date range.
|
VALID_DATE_DMY | Verifies that the data pattern given in the
Day / Month / Year
format is a valid date within the 1901-01-01 to 2099-12-31 date range.
|
VALID_DATE_MDY | Verifies that the data pattern given in the
Month / Day / Year
format is a valid date within the 1901-01-01 to 2099-12-31 date range.
|
VALID_DATE_YMD | Verifies that the data pattern given in the
Year / Month / Day
format is a valid date within the 1901-01-01 to 2099-12-31 date range.
|
VALID_PRESENT_DATE_DMY | Same as VALID_DATE_DMY and additionally verifies that the matched date is not greater than the current date. This module can be used to verify dates that cannot be in the future, such as a person's date of birth. |
VALID_PRESENT_DATE_MDY | Same as VALID_DATE_MDY and additionally verifies that the matched date is not greater than the current date. This module can be used to verify dates that cannot be in the future, such as a person's date of birth. |
VALID_PRESENT_DATE_YMD | Same as VALID_DATE_YMD and additionally verifies that the matched date is not greater than the current date. This module can be used to verify dates that cannot be in the future, such as a person's date of birth. |
To add a CHECK rule for a base pattern in GLASS Studio Visual Builder Mode:
To edit a CHECK rule:
To remove a CHECK rule: