User Guide

Regular Expression Number Generator

This section provides a comprehensive description of the regular expression (regex) number generation transformation type.

For a summary of the rule and its compatibility with platform jobs and execution environments, see masking-rules.png Masking Rule Types.

Data Types

The regex number generator supports the following data types:

  • Byte

  • Integer

  • Long

  • Short

Description

The value is replaced by a randomly generated number that matches the supplied regular expression. For example, take an initial value of:

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 regex number generator 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 the platform, see Regular Expression Syntax. (Click on the RegExp class in the Class Summary table.)

You can unmask fields that have been masked with the regex number generator.

Examples

Here are examples of regular expressions that you can use to match some example fields and formats:

Field

Format

Expression

Employee ID (For example, 52938486)

12345678

[0-9]{8}

US ZIP Code (For example, 10286)

12345

[0-9]{5}

Tokenization Behavior