You should check your extrusion rule and related configuration details (rule actions, s-tap ) because the regex pattern is valid. Also Data Redaction has some limitations, please check the attachment and link.
Original Message:
Sent: Fri November 01, 2024 07:34 AM
From: Ahmad Hassan Tariq
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
Hello Veysel Gundogdu
I tried the regex you mentioned ^([0-9]{4})([0-9]{4})([0-9]{4})([0-9])$
, but it didn't work and didn't mask the data. Additionally, I have uploaded a snapshot for your reference.
Secondly, if we use sign ^ and & , masking didn't work.
------------------------------
Ahmad Hassan Tariq
Original Message:
Sent: Fri November 01, 2024 06:42 AM
From: Veysel Gundogdu
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
Hi Ahmad,
Could you try this one ^([0-9]{4})([0-9]{4})([0-9]{4})([0-9])$
for 1234567890123 format.
I hope it works the way you want it to
------------------------------
Veysel Gundogdu
Original Message:
Sent: Fri November 01, 2024 03:16 AM
From: Ahmad Hassan Tariq
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
Hello Marcio Bulek,
Thank you for your response. I tried the regex you mentioned, but it didn't work and didn't mask the data. Additionally, I have uploaded a snapshot for your reference.
Secondly, to capture a 13-digit CNIC with dashes, if the regex ([0-9][0-9][0-9][0-9])[0-9]-([0-9][0-9][0-9][0-9])[0-9][0-9][0-9]-([0-9]) is used, it will mask the data as well. However, if you use ^
and $
at the start and end, it does not work.I have uploaded a snapshot for your reference.
In my case, the CNIC is without dashes, such as 1234567890123
. Please provide the specific regex pattern for masking to capture this format.
------------------------------
Ahmad Hassan Tariq
Original Message:
Sent: Wed October 30, 2024 03:40 PM
From: Marcio Bulek
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
Hello Ahmad,
I searched online and it seems a CNIC number has the following format: XXXXX-XXXXXX-X For example: 12345-1234567-1
This regex should work: ^[0-9]{5}-[0-9]{7}-[0-9]$
------------------------------
Marcio Bulek
Original Message:
Sent: Wed October 30, 2024 12:02 PM
From: Ahmad Hassan Tariq
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
Hello,
Thank you for the suggestion. I have tried using the ^
and $
symbols in the regex to define the start and end positions, but this approach did not result in masking at the database level as expected.
Any additional guidance on ensuring that the regex effectively masks data at the DB level would be greatly appreciated.
Thanks again for your assistance
------------------------------
Ahmad Hassan Tariq
Original Message:
Sent: Wed October 30, 2024 09:48 AM
From: Marcio Bulek
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
Hello Ahmad,
For card numbers I suggest using the Guardium built-in special pattern test: guardium://CREDIT_CARD (https://www.ibm.com/docs/en/gdp/12.x?topic=policies-special-pattern-tests)
For custom regex capturing sequences longer than the intended length, you may use ^ and $ to indicated positions at start and end of a line respectively. There are several websites that helps build and test regex. For example: https://regex101.com/
Hope this helps
------------------------------
Marcio Bulek
Original Message:
Sent: Tue October 29, 2024 03:30 AM
From: Ahmad Hassan Tariq
Subject: Ensuring Exact Length Matches in Regex for CNIC and Card Number Masking in Guardium
I'm working on a masking use case for CNIC (13-digit) and card numbers (16-digit) using regular expressions. We've created a regex to capture 13 characters for CNIC and 16 characters for card numbers, but we're facing an issue where the regex captures sequences longer than the intended length.
For the CNIC, we're using this regex: ([0-9][0-9][0-9][0-9])[0-9]-([0-9][0-9][0-9][0-9])[0-9][0-9][0-9]-([0-9])
. with Dashes
And for card numbers with spaces between each group of 4 digits, we're using: ([0-9][0-9])[0-9][0-9] ([0-9][0-9])[0-9][0-9] ([0-9][0-9])[0-9][0-9] ([0-9][0-9])[0-9][0-9]
.
How can we ensure that the regex captures only exactly 13 characters for CNICs and exactly 16 characters for card numbers, without matching any longer sequences?
Thank you for your guidance!
------------------------------
Ahmad Hassan Tariq
------------------------------