Replacing Credit Card Numbers
- by Del
Hi,
I'm using an sql to replace credit card numbers with xxxx and finding that REGEX_REPLACE does not consistently replace everything. Below is the SET command i'm using on the SQL
SET COMMENTS_LONG =
REGEXP_REPLACE (COMMENTS_LONG,'\D[1-6]\d{3}.\d{4}.\d{4}.\d{3}(\d{1}.\d{3})?|\D[1-6]\d{12,15}|\D[1-6]\d{3}.\d{3}.?\d{3}.\d{5}', ' XXXXXXXXXXXXXXXX')
Before
Elizabeth aclled to change address.5430-6000-2111-1931 A
After
Elizabeth aclled to change address XXXXXXXXXXXXXXXX1 A
I tried increasing the number of X but result is the same. I also find that i have to put a space in front of the first X as it appears to move 1 char to the left.