Regular Expression Number Generator
This section provides a comprehensive description of the Regular Expression Number Generator Rule.
For a summary of the rule and its compatibility with Privitar jobs and execution environments, see Masking Rule Types.
Data Types
The supported data types for this rule are:
Byte, Short, Integer, Long
Description
The value is replaced by a randomly generated number that would match the supplied regular expression. For example, for an initial value:
1234
To replace this with a randomly generated 4-digit number, you could use the following regular expression:
[0-9]{4}
which could produce a value such as:
4059
A more complex example, would be:
[1-4]{1}[0-9]{3}
The first part of the expression ([1-4]{1}
) generates one number between 1
and 4. The second part of the expression ([0-9]{3}
) generates three numbers between 0
and 9
.
The regular expression specifies a pattern that the generated number should match. Only expressions generating integers are accepted, and the range of potential minimum and maximum values that can be generated based on the expression has to be compatible with the data types the Rule is applied to.
Masking Behavior
The options are described in the following table:
Option | Description |
---|---|
Regular expression | The pattern that the generated number should match. For more information about the regular expression syntax supported in Privitar, see Regular Expression Syntax. (Click on the RegExp class in the Class Summary table.) |
Examples
Here are examples of regular expressions that could be used to match some example fields and formats:
Field | Format | Expression |
---|---|---|
Employee ID (For example, 52-938486) | xx-xxxxxx | [0-9]{2}-[0-9]{6} |