Pure Programmer
Blue Matrix


Cluster Map

Project: Credit Card Mask

Write a function that takes a credit card number in the format "1234 5678 9012 3456" and returns a string with all but the last four digits replaced with an "X". Use a regular expression to match a group of four digits followed by a space and replace them with "XXXX ".

Output
$ perl CreditCardMask.pl XXXX XXXX XXXX 3456 XXXX XXXX XXXX 1929 XXXX XXXX XXXX 3902

Solution