Skip to main content

Generate from pattern

This function generates a value based on a user-defined pattern.

This function is applied only on Strings.

Option Description
Extra parameter This function requires an extra parameter.

The extra parameter is a pattern that follows those rules:

  • A is replaced with a random Latin uppercase letter.
  • a is replaced with a random Latin lowercase letter.
  • 9 is replaced with a random digit.
  • H is replaced with a random Hiragana character.
  • K is replaced with a random full-width Katakana character.
  • k is replaced with a random half-width Katakana character.
  • C is replaced with a random Kanji character.
  • G is replaced with a random Hangul character.

All other characters are copied to the generated value as is.

For more information about the supported character types and the related Unicode ranges, see Data masking functions in the masking components.

You can also use numbered backreferences (\\<number>) using the following syntax: <pattern>\\<number>,<group1>,<groupN>.

  • <pattern> corresponds to the pattern to be used for generating the output value.
  • \\<number> is a numbered backreference. <number> identifies the position of the group placed after the "," character.
  • <group1>,<groupN> are comma-separated groups of characters. Each group is treated as a single unit. If a backreference calls a group, it is added as is in the generated value.

If you want to copy a character used in patterns (A, a, 9, H, h, K, k, C, G) as is in the generated value, use a backreference.

This function does not work correctly if a comma ',' is used in the pattern.

In the following example:
  • a characters are replaced with random Latin lowercase letters.
  • s characters are not masked in the generated output.
  • \\2 calls the group placed after the second "," character, which is @talend.com.
Input value Extra parameter Example of a masked value
A26 "aaaass\\2,@gmail.com,@talend.com" hjdfss@talend.com
In the following example:
  • \\3 calls the group placed after the third "," character, which is a.
  • 9 characters are masked with random digits.
Input value Extra parameter Example of a masked value
A26 "\\39999,D,Z,a" a4825

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!