Syntax for the pattern tokenizer
When creating a new token profile you can select Pattern as Tokenizer. In this case you need to define a custom pattern for the tokens to be generated.
The pattern syntax is similar to regular expressions and has the following notation:
| Syntax element | Explanation | Example |
|---|---|---|
| <?> | The characters between the parentheses are output
directly. Allowed characters: valid chars except ">" which has to be escaped: \> |
|
| [?] | One character is chosen randomly from:
|
|
| [](?) | In the round parentheses you enter how many characters should be generated. |
|
| [](#) | Generate a token with the same length as the input value (# = length of input value). |
|
| [](#-?) | Generate a token with the same length as the input value minus the noted number. |
|
| {?} | Take from the input value the char from the noted
position. Note: Regarding the position of chars, One-based
numbering is used (the initial element of a sequence is assigned
the index 1). |
|
| {?...?} | Take from the input value the chars from the noted start to end. |
|
| {?...#} | Take from the input value the chars from the noted start to the end of the input value. |
|
| {#-x} | Select a single character from the input value with the index # (end of input) minus x. |
|
Some more examples:
- Input in the Pattern field: <XYZ>{4...#}[0-9](3)
- Token input value: qwertz
- Token output value: XYZrtz771
- Input in the Pattern field: [a-z](#)
- Token input value: qwertz
- Token output value: stlgmu
- Input in the Pattern field: [1-9](1)[0-9](7)<9>[0-9](7)
- Token input value: 1234567890123456
- Token output value: 5794786197851005
Note: Any parts of the pattern that go out of bounds are ignored / tokenized to
"". For example: With the input value
12345 the pattern
<outofrange>{#-10}[A-Z](3) produces the following
token: outofrangeKFV or something similar. Whereas with
the input value 1234567890abcdef a token like
outofrange6BEM is produced.
Note: Pattern Tokenizers can be generic under the condition of having a prefix with a
minimum length of three characters (e.g.,
<PRE>[a-zA-Z0-9](8)).
