{"id":"code-work-cs-mask-card-numbers","audience":"customer-support","category":"coding","track":"coding","technique":"constraints","title":"Mask card numbers in ticket text before sharing","free":false,"task":"Before the ticket log goes to the product team, card numbers customers pasted must be masked. Write one Google Sheets formula for B2 (filled down) that replaces any 13- to 16-digit card number in A2, even with spaces or dashes between groups, with **** plus its last 4 digits (like **** 4242). Order numbers like CK-10422 and 10-digit phone numbers must stay as they are. One formula in one code block, then under 25 words outside the code.","materialLabel":"Ticket log sample (attached to your prompt automatically)","material":"TICKET LOG - Copper Kettle support, sample rows (row 1 is headers)\nA Customer message | B Safe to share\n\"charged twice on 4111 1111 1111 4242 for order CK-10422\" | ?\n\"my card 5500-0000-0000-0004 was declined??\" | ?\n\"call me at 503 555 0142 about CK-10431\" | ?\n\"refund to 371449635398431 please\" | ?\n\"where is my order\" | ?\n\nNotes from Rosa (support lead):\n- Customers should never paste card numbers, but about one in fifty does.\n- The product team reads the log every sprint to spot trends.\n- Phone numbers are fine to share internally.\n- We already delete the original tickets after 90 days.","rules":[{"type":"codeBlocks","count":1},{"type":"maxProseWords","max":25}],"mistakes":[{"title":"Not mentioning spaces and dashes","why":"The AI matches 16 digits in a row and misses 4111 1111 1111 4242.","fix":"Add: \"Card numbers may have spaces or dashes between groups.\"","checks":["r0"]},{"title":"Not showing the mask","why":"The AI blanks the number or hides all of it, so support can't match the card.","fix":"Add: \"Replace with **** and the last 4, like **** 4242.\"","checks":["r1"]},{"title":"Masking too much","why":"A loose pattern also hides phone and order numbers.","fix":"Add: \"Only 13-16 digit numbers; leave CK-10422 and phone numbers alone.\"","checks":["r2"]},{"title":"Getting a menu of options","why":"The AI likes to offer two or three versions of the formula, so you're left to pick and test them yourself.","fix":"Add: \"Give one formula only, in one code block, no alternatives.\"","checks":["codeBlocks"]},{"title":"Getting a tutorial","why":"By default the AI explains every part of the code at length, which you then have to scroll past.","fix":"Add: \"After the code, one line under 10 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Mentions spaces and dashes","patterns":["spaces?","dash","hyphen"]},{"label":"Shows the mask","patterns":["\\*{4} ?\\d{4}","last 4","last four"]},{"label":"Protects other numbers","patterns":["13","16","phone","order number|ck-"]},{"label":"Asks for one answer only","patterns":["\\b(one|single|1)\\s+(formula|code block|block|version)","only one","no (alternatives|options|other versions)"]},{"label":"Limits the explanation","patterns":["\\d+\\s*words","no (explanation|notes|commentary)","one (short )?(line|sentence)","nothing else"]}],"hint":"Show the AI what a masked number looks like, how card numbers get typed, and which numbers must not be touched.","rubricLabels":["Uses REGEXREPLACE with a pattern that matches 13 to 16 digits even with single spaces or dashes between them (for example \"\\b(?:\\d[ -]?){9,12}(\\d{4})\\b\")","Replaces each match with **** followed by the last 4 digits (like **** 4242), not with a blank or a fully hidden number","Leaves shorter numbers alone, so CK-10422 and 503 555 0142 are unchanged"]}