masking with zero

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • Answered
Hello,

I want to know if it's possible to create an algorithm in the Masking engine that can replace any number within a string column by zeros (as long as initial number is)
I tried to make one with segment mapping, but i can't make range between 0 and 0 for example.

here is an example of results that i want :

BEFORE_MASKING  AFTER_MASKING
1234            0000
123             000
045678          000000
etc.

I there a way to do such thing with masking algorithm ?

thanks for your help
Photo of Nicolas Ronayette

Nicolas Ronayette

  • 206 Points 100 badge 2x thumb

Posted 8 months ago

  • 0
  • 1
Photo of Mayank Ahluwalia

Mayank Ahluwalia

  • 708 Points 500 badge 2x thumb
Hi Nicolas,

You can use the Segmented Algorithm. Create each segment as Alphanumeric and take length of segment as 4. 

For each segment, for each character, define the range of mask values as 0,0.

Just tested this and works fine :)

Number of segments you will need to define will depend on the longest length you expect to handle. So, for instance, you expect the longest length as 26, then, you should define 7 alphanumeric segments, each of length 4, and within each segment, for each character define range of mask values as 0,0

I hope this clarifies.

Regards,
Mayank
Photo of Nicolas Ronayette

Nicolas Ronayette

  • 206 Points 100 badge 2x thumb
Thanks a lot Mayank

It's exactly what i was looking for.
Perfect !
I was trying to use min and max instead of range (i though range was "steps" between numbers).

WIth your example, it's working for me too

Thank again for your help
(Edited)
Photo of Gary Hallam

Gary Hallam, Official Rep

  • 2,008 Points 2k badge 2x thumb
You should also be able to do this with a redaction algorithm, changing any number with 0.  I haven't tried this out but it should work with fields longer than those handled by segmented mapping.  It's probably a more expensive algorithm from a processing time requirement though.
Regards,
Gary
Photo of Gary Hallam

Gary Hallam, Official Rep

  • 2,008 Points 2k badge 2x thumb
I checked this out and found that the redaction algorithm did not work as it did not iterate across all numbers only across single numbers.

so in a text field "1234 1 2 3 4"
Using a regular expression redaction with [0-9]* and replacement of 0 you get:
"0 0 0 0 0"
Using a regular expression redaction with [0-9] and replacement of 0 you get:
"1234 0 0 0 0"
Using a regular expression redaction with a text file list of numbers from 0 to 9 and replacement of 0 you get:
"1234 0 0 0 0"
Mayank wins... ;-)
Photo of Mayank Ahluwalia

Mayank Ahluwalia

  • 708 Points 500 badge 2x thumb
Actually this should work too, I am surprised that it is taking 1234 as a single number instead of 4 digits.