Skip to main content

User Guide

Regular Expression Text Generator

This section provides a comprehensive description of the Regular Expression Text Generator Rule.

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

Data Types

The supported data types for this rule are:

  • Text

Description

The value is partially or completely replaced by a randomly generated string that would match 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.

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 Privitar, 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 replace. Start index 0 is the beginning of the string. Index 1 would be after the first character of the string.

Length to Replace

The length of the string to replace. This is required for partial replace. The value entered will be the number of characters from the string that will be replaced.

Examples

Here are examples of regular expressions that could be used to match some example fields and formats:

Field

Format

Expression

Email address

xxxxxxx@xxxxx.com

[a-z]{7}\@[a-z]{5}\.com

Surname

xxxxxxxx

[a-z]{8}

Tokenization Behavior