- 
Select the tab “Detection Patterns”.

 - 
Click on the specific Detection Pattern Name.

 - 
If you’re already in the Setup, navigate to: Setup > Custom Code > Custom Metadata Types > DetectionPattern > Manage DetectionPattern.
 - 
You should see a list of Detection Patterns. Click Edit on the Pattern you wish to configure.

 - 
Enter a Pattern.
This pattern must be a valid Regular Expression. Try a free tool like this to check whether your regex is valid. - 
Select Mask Character.
Enter any single character you want to mask PII numbers with - the default is an asterix (e.g. AMERICANEXPRESS****) but you could use an X, #, @, or any other single character you need. - 
Select Mask Type.
- "Full Mask": all characters are masked
 - "Last4": all credit card number characters are masked but the last 4 characters (AMERICANEXPRESS****1234)
 - "First6andLast4": all credit card number characters are masked but the first 6 and the last 4 characters (AMERICANEXPRESS123456**1234)
 
 - 
If the pattern is for credit card numbers, check the box
LuhnCheck.- When this box is checked, all numbers matching this pattern will go through a Luhn algorithm check for credit card number validity.
 - If this box is unchecked, all numbers matching this pattern will skip the Luhn algorithm.
 
 
The Luhn algorithm, also known as the modulus 10 or mod 10 algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, Canadian Social Insurance Numbers.
- 
Check the box
IsActive. - 
Press Save.
 
Tip: It is recommended that you only store the minimum amount of credit card digits you need to verify customer accounts.