Regular Expression Text Generator
This section provides a comprehensive description of the regular expression (regex) text generation transformation type.
For a summary of the rule and its compatibility with platform jobs and execution environments, see
Masking Rule Types.
Data Types
The regex text generator supports the following data types:
Text
Description
The value is partially or completely replaced by a randomly generated string that matches the supplied regular expression. For example, for an initial value:
abcdef
you could use the following regular expression:
[a-z]{6}
This would produce an output such as:
mvskyc
Optionally specify Start Index and Length to Replace to replace a part of the input value with the generated text. For example, with an input of abcdef and a pattern of [0-9]{4}, replacing four characters from position 1, an output might be a4321f.
Note
By default there is a 1,000-character maximum on regular expressions.
Masking Behavior
The options are described in the following table:
Option | Description |
|---|---|
Regular Expression | The pattern that the generated text 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.) |
Start Index | Where to start replacing the string. This is required for partial replacements. Start index 0 is the beginning of the string. Index 1 is after the first character of the string. |
Length to Replace | The length of the string to replace. This is required for partial replacements. The value entered will be the number of characters from the string that will be replaced. |
You can unmask fields that have been masked with the regex text generator.
Note
When transforming data using a consistent regular expression (regex), it is expected that all data values match the regular expression to return consistent results. If all the data values do not match the regular expression, the request will fail and return an error. For example, if a regex specifies a capital letter [A-Z][a-z]{1,15}, and the the data doesn't include a capital letter, the platform returns an error.
Examples
Here are examples of regular expressions that you could use to match some example fields and formats:
Field | Format | Expression |
|---|---|---|
Email Address | xxxxxxx@xxxxx.com | [a-z]{7}\@[a-z]{5}\.com |
Last Name | xxxxxxxxxxxxxxx | [a-z]{15} |
