KB Article #101347

How to match credit card numbers in Email Firewall or MailGate

The article provides a set of expressions you can use to match credit card numbers in Email Firewall (EMF) or MailGate.

Details

In case you notice that the expressions included in the GLBA lexicon generate high number of false positives when used in policies, you can use the set of expressions provided below. It will match valid credit cards of all described types.

The list includes all range extensions published in October 2009.

The list is formatted so that you can import it in MailGate and EMF word lists. It is recommended to create separate list for credit cards, since the GLBA lexicon contains many expressions that could be triggered instead of these.

"**(\\VISA_card){0}\D4(\d{12})(\d{3})\D",5
"**(\\VISA_card_13_digits){0}\D4(\d{12})\D",5
"**(\\Mastercard){0}\D5([1-5])(\d{14})\D",5
"**(\\American_Express){0}\D3([47])(\d{13})\D",5
"**(\\DinersClub_card_1){0}\D30[0-5](\d{11})\D",5
"**(\\DinersClub_card_2){0}\D3095(\d{10})\D",5
"**(\\DinersClub_card_3){0}\D3[689](\d{12})\D",5
"**(\\Discover_card){0}\D6((011)|([45]\d{2}))(\d{12})\D",5
"**(\\Discover_card_CUP){0}\D62[24568](\d{13})\D",5
"**(\\JCB_card){0}\D((2131)|(1800)|(35\d{3}))\d{11}\D",5
"**(\\enRoute_card){0}\D(2\d{3})\d{11}\D",5
"**(\\VISA_delimited){0}\D((4\d{3}))(-|\s|\.)\d{4}(-|\s|\.)\d{4}(-|\s|\.)\d{4}\D",5
"**(\\VISA_card_13_digits_delimited){0}\D4(\d{3})(-|\s|\.)\d{3}(-|\s|\.)\d{3}(-|\s|\.)\d{3}\D",5
"**(\\MasterCard_delimited){0}\D((5[1-5]\d{2}))(-|\s|\.)\d{4}(-|\s|\.)\d{4}(-|\s|\.)\d{4}\D",5
"**(\\American_Express_delimited){0}\D(3[47]\d{2})(-|\s|\.)\d{6}(-|\s|\.)\d{5}\D",5
"**(\\DinersClub_card_1_delimited){0}\D30[0-5](\d)(\.|\s|-)(\d{3})(\.|\s|-)(\d{3})(\.|\s|-)(\d{4})\D",5
"**(\\DinersClub_card_2_delimited){0}\D3095(\.|\s|-)(\d{3})(\.|\s|-)(\d{3})(\.|\s|-)(\d{4})\D",5
"**(\\DinersClub_card_3_delimited){0}\D3[689](\d{2})(\.|\s|-)(\d{3})(\.|\s|-)(\d{3})(\.|\s|-)(\d{4})\D",5
"**(\\Discover_card_delimited){0}\D6((011)|([45]\d{2}))(\.|\s|-)(\d{4})(\.|\s|-)(\d{4})(\.|\s|-)(\d{4})\D",5
"**(\\Discover_card_CUP_delimited){0}\D62[24568](\d)(\.|\s|-)(\d{4})(\.|\s|-)(\d{4})(\.|\s|-)(\d{4})\D",5
"**(\\JCB_card_delimited){0}\D((2131)|(1800)|(35\d{2}))(-|\s|\.)(\d{4})(-|\s|\.)(\d{4})(-|\s|\.)(\d{4})\D",5
"**(\\enRoute_card_delimited){0}\D(2\d{3})(-|\s|\.)(\d{4})(-|\s|\.)(\d{4})(-|\s|\.)(\d{3})\D",5


NOTE: You need to remove the double asterisks (**) from the expressions above when used with MailGate.