club id
, member
, membership
In Part 1, we start by defining the most basic requirement of the club membership ID - a string of seven (TIMES 7) consecutive ASCII digits (RANGE DIGIT).
RANGE DIGIT TIMES 7
See RANGE and Preset Keywords for more information.
Based on Requirement #3, the club membership ID must not be contained within a string of alphanumeric characters. This means the pattern boundaries on either side of a club membership ID can be any character other than ASCII alphabets or numbers (BOUND NONALNUM).
(RANGE DIGIT TIMES 7) BOUND NONALNUM
()
in the expression do not change the
logic or precedence of operations. They are added for
readability.See BOUND and Preset Keywords for more information.
In Part 3, we create a namespace (MAP NOCASE 'CLUB_MEMBERSHIP_ID_CONTEXTS') containing all the (case-insensitive) keywords that are commonly found before a club membership ID as listed in Requirement #4.
MAP NOCASE 'CLUB_MEMBERSHIP_ID_CONTEXTS' 'id', 'member', 'membership'
(RANGE DIGIT TIMES 7) BOUND NONALNUM
In Part 4, we declare (CONTEXT 'CLUB_MEMBERSHIP_ID_CONTEXT') and apply (APPLY 'CLUB_MEMBERSHIP_ID_CONTEXT') a context rule that requires (REQUIRE 'CLUB_MEMBERSHIP_ID_CONTEXTS') the contextual keywords (defined in Part 3) to be present before (BEFORE) a potential match for it to be reported.
MAP NOCASE 'CLUB_MEMBERSHIP_ID_CONTEXTS' 'club id', 'member', 'membership'
CONTEXT 'CLUB_MEMBERSHIP_ID_CONTEXT' BEFORE REQUIRE 'CLUB_MEMBERSHIP_ID_CONTEXTS'
((RANGE DIGIT TIMES 7) BOUND NONALNUM) APPLY 'CLUB_MEMBERSHIP_ID_CONTEXT'
See MAP, CONTEXT and APPLY, REQUIRE, RANGE, Preset Keywords, BOUND, and Grouping Operator for more information.
Based on the GLASS expression in Part 4 - Declaring a Context Space, the 7-digit strings underlined in line 1 and line 2 will be returned as matches by the GLASS pattern matching engine as they fulfill the boundary and context rules.
1 2 3 4 |
...My _membership_ number is 2210456... _Club ID_: 5131789 The quick brown fox jumped over a lazy sleeping dog. 29DF1440AA2BF58CA41AC0A4244B232210456215 |
The 7-digit string in line 4 will not be marked as a match as it fails the BOUND rule and no contextual keywords are found within 64-bytes before the potential match.