# 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.<br><br>The extra parameter is a pattern that<br>follows those rules:<br><br><ul> <li> <span>A</span> is replaced with a							random Latin uppercase letter.</li> <li> <span>a</span> is replaced with a							random Latin lowercase letter.</li> <li> <span>9</span> is replaced with a							random digit.</li> <li> <span>H</span> is replaced with a							random Hiragana character.</li> <li> <span>K</span> is replaced with a							random full-width Katakana character.</li> <li> <span>k</span> is replaced with a							random half-width Katakana character.</li> <li> <span>C</span> is replaced with a							random Kanji character.</li> <li> <span>G</span> is replaced with a							random Hangul character.</li> </ul><br><br>All other characters are copied to the generated value<br>as is.<br><br>For more information about the supported<br>character types and the related Unicode ranges, see [Data masking functions in the masking components](https://help.qlik.com/talend/en-US/components/7.3/data-privacy/data-masking-functions-in-masking-components).<br><br>You can also use<br>numbered backreferences (\\&lt;number&gt;) using the following syntax: &lt;pattern&gt;\\&lt;number&gt;,&lt;group1&gt;,&lt;groupN&gt;.<br><br><ul> <li> <kbd>&lt;pattern&gt;</kbd>							corresponds to the pattern to be used for generating the output							value.</li> <li> <kbd>\\&lt;number&gt;</kbd>							is a numbered backreference. <kbd>&lt;number&gt;</kbd> identifies the position of the group							placed after the "<kbd>,</kbd>"							character.</li> <li> <kbd>&lt;group1&gt;,&lt;groupN&gt;</kbd> 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.</li> </ul><br><br>If you want to copy a character used in patterns<br>(A, a,<br>9, H,<br>h, K,<br>k, C,<br>G) as is in the generated value, use a<br>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 |