Regex-Based Masking Overview

Updated 

Regex masking of Personally Identifiable Information (PII) is a technique employed to safeguard sensitive personal data by partially or completely concealing specific information within a message. PII encompasses data elements such as names, addresses, social security numbers, phone numbers, and other identifiable information that can be utilized to identify or contact an individual.

In the application of regex masking, PII content is substituted with non-sensitive, randomized, or obfuscated values. This ensures that even if unauthorized individuals gain access to the database, the original PII data remains inaccessible and unidentifiable.

The process of data masking through regex involves two steps:

1. Identifying PII Data in the Message

This step utilizes Regular Expressions (Regex) to discern PII data within the message. The effectiveness of PII identification depends on the chosen Regex, determining whether specific information qualifies as PII or not.

2. Obfuscation Rule Application

Once PII is identified, the rule engine takes over, replacing the recognized text with obfuscated values. The obfuscation ensures that the replaced information is non-sensitive and retains privacy, thereby safeguarding the original PII data.

Both steps are configured within a rule engine, where Regex patterns are defined to identify PII, and corresponding actions are set to obfuscate the PII data, forming a robust mechanism for data protection and privacy in various communication channels.

Note that PII masking is supported for both live calls and calls imported onto the platform.

Examples of Masking Use Cases with Regular Expressions (Regex)

Credit Card Number Masking Scenario 1:

Regex: (\d{4} \d{4} \d{4} \d{4})|(\d{16})

Mask With: XXXX XXXX XXXX XXXX

Input: 1234 1234 1234 1234 OR 1234123412341234

Output: XXXX XXXX XXXX XXXX

Credit Card Number Masking Scenario 2:

Regex: (?<=\b\d{4}[-]\d{2})\d{2}[-]\d{4}[-](?=\d{4}\b)

Mask With: XX-XXXX

Input: 1234-1234-1234-1234

Output: 1234-12XX-XXXX-1234

OTP Masking:

Regex: ^[0-9]{6}$

Mask With: XXXXXX

Input: 123456

Output: XXXXXX

Social Security Number (SSN) Masking:

Regex: (\b)(\d{3})([-]?)(\d{2})([-]?)(\d{4})(\b)

Mask With: XXX-XX-XXXX

Input: 123-12-1234

Output: XXX-XX-XXXX