REDACT - Working with regex on Windows DB servers
When you use regular expressions with REDACT with Windows database servers, you need to be aware of some caveats and workarounds.
Symptoms
When you use Guardium® REDACT in your policy, the policy does not recognize the following regular expressions:Regex | Description |
---|---|
{n} | Repeat n times. That is, match the preceding item n times. |
[xNN] | 2-digit hex number. |
[NNN] | 3-digit octal number. If possible, specify the ASCII equivalent. |
Causes
Windows server does not support all regular expression patterns.Note: REDACT policies
that use regex can only scrub null-terminated data types.
Environment
Guardium collectors that receive data from Windows database servers.Resolving the problem
Depending on the regex issue, rewrite your regex as follows:- Instead of {n}, specify each digit that you want to match. For example,
instead of the following regex:
Use the following expression:[0-9]{5}
[0-9][0-9][0-9][0-9][0-9]
- [xNN] signifies a 2-digit hexadecimal
number, such as [x41]. Windows
S-TAP does not support this pattern. No perfect alternative pattern exists, but if [xNN] matches to a specific ASCII character, you can replace the hex number with its ASCII counterpart. For example, the hexadecimal number x41 maps to the ASCII character A. In this case, you can replace the following regex:
With this expression:[x41][0-9][0-9][0-9][0-9][0-9]
A[0-9][0-9][0-9][0-9][0-9]
- [NNN] signifies a 3-digit octal number such as 102. Windows
S-TAP does not support this pattern.No perfect alternative pattern exists, but if [NNN] matches to a specific ASCII character, you can replace the octal number with its ASCII counterpart. For example, the octal number 102 maps to the ASCII character B. In this case, you can replace the following regex:
With this expression:[102][0-9][0-9][0-9][0-9][0-9]
B[0-9][0-9][0-9][0-9][0-9]
If one of these patterns does not resolve the problem in your environment, contact IBM® Technical Support if you need further analysis.