You use text format expressions to define patterns
for randomly generated text data. It might make your test data look more
meaningful for your business situation. For example, invoice_number
VARCHAR(20) column might contain your company invoices, which look like:
INV-99/345-ABC, where 99 is year number, which can be between 90 and 99,
345 is the serial number of the invoice and ABC are 3 capital letters. You
can set this patters for the column random data by specifying the following
format expression:
INV-9[0-9]/[1-9][1-9][1-9]-[A-Z][A-Z][A-Z]
If in some column you use code character, which value can only be 'K','Y', and 'H', you can enforce this rule by entering the following pattern:
[KYH]
| * |
The asterisk (*) matches zero or more characters. |
| [...] | The square brackets ([...]) match any of the
enclosed characters, including character ranges as in [a-z]. Characters inside the square brackets can be escaped. |
| \ | The backslash (\) removes the special significance of the
next character (used to match * or ? by writing \* or \?). |
| ? |
The question mark (?) matches any single character. |
To define string pattern with 3 upper case characters each of them between A and H:
[A-H][A-H][A-H]
To define US telephone number, which usually looks like: (212) 555-1212
([1-9][1-9][1-9]) [1-9][0-9][0-9]-[0-9][0-9][0-9][0-9]
To define any 5 alpha numeric characters:
?????
To define a string, which starts with word INV#- and after that can contain any number of alphanumeric characters:
INV#-*