Protection of Credit Cards

2 mins read

Regular expressions and life hacks to control the prevention and monitoring of the transfer of credit cards of payment systems Visa, Mastercard, Mir in the DLP system.

  • RegEx
(?:^|\s)(?:[4|5|6|9]\d{3})([ -]?)\d{4}\1\d{4}\1\d{4}(?:$|\s|\.|\,)
payment_visa_icon
mastercard_payment_icon
logo-image-blue

Regular expression for Visa, MasterCard and Prostir.

  • RegEx
(?:^|\s)(?:4\d{3})([ -]?)\d{4}\1\d{4}\1\d{4}(?:$|\s|\.|\,)
payment_visa_icon

Regular expression for Visa Credit Cards.

(?:^|\s) – start of string (with a new line or space)
(?:4\d{3}) – start with digit 4 and random 3 digits
([ -]?)\d{4}\1\d{4}\1\d{4} – space or dash every random 4 digits 3 times
(?:$|\s|\.|\,) – end of string (line end, space, dot, or comma)

Example:
4916 9006 6151 3107 and 4609-3639-2287-9340 and 4369559843305287

  • RegEx
(?:^|\s)(?:5\d{3})([ -]?)\d{4}\1\d{4}\1\d{4}(?:$|\s|\.|\,)
mastercard_payment_icon

Regular expression for MasterCard.

(?:^|\s) – start of string (with a new line or space)
(?:5\d{3}) – start with digit 5 and random 3 digits
([ -]?)\d{4}\1\d{4}\1\d{4} – space or dash every random 4 digits 3 times
(?:$|\s|\.|\,) – end of string (line end, space, dot, or comma)

Example:
5404 3664 0602 4840 and 5404-3658-7741-3532 and 5404363072774782

  • RegEx
(?:^|\s)(?:[6|9]\d{3})([ -]?)\d{4}\1\d{4}\1\d{4}(?:$|\s|\.|\,)

Regular expression for Prostir (Ukrainian System).

(?:^|\s) – start of string (with a new line or space)
(?:[6|9]\d{3}) – start with digit 6/9 and random 3 digits
([ -]?)\d{4}\1\d{4}\1\d{4} – space or dash every random 4 digits 3 times
(?:$|\s|\.|\,) – end of string (line end, space, dot, or comma)

Example:
6404 3664 0602 4840 and 6404-3658-7741-3532 and 6404363072774782

9404 3664 0602 4840 and 9404-3658-7741-3532 and 9404363072774782

  • RegEx
(?:^|\s)(?:2\d{3})([ -]?)\d{4}\1\d{4}\1\d{4}(?:$|\s|\.|\,)
mir

Regular expression for Mir.

(?:^|\s) – start of string (with a new line or space)
(?:2\d{3}) – start with digit 2 and random 3 digits
([ -]?)\d{4}\1\d{4}\1\d{4} – space or dash every random 4 digits 3 times
(?:$|\s|\.|\,) – end of string (line end, space, dot, or comma)

Example:
2404 3664 0602 4840 and 2404-3658-7741-3532 and 2404363072774782



 $ 36.9   39.7   8.8