Custom-String Generator - Supported Regular Expressions

Applies to TestComplete 15.62, last modified on March 19, 2024

TestComplete includes the Custom String generator that helps you generate data in the format you need. This generator uses macros, string literals and specific regular expressions to let you get the desired data. You can find information about these regular expressions below. For information on using regular expressions for generating custom strings, see Custom String Generator Rules.

Note: This topic provides information on regular expressions understood by the Custom String generator. For information on regular expressions that can be used in the Find dialog of TestComplete, see Regular Expressions Syntax.

The Custom String generator supports the following regular expression tokens:

Token Description
. Generates any single printable character. For example, h.t can generate hmt, h3t, and so on.
[] Generates one character from those specified within the brackets. For example, [a2c] can only generate a, 2 or c.
[^] Generates any character except for those that are specified within the brackets. For example, [^a2c] can generate any character except for a, 2 and c.
- Specifies a range of generated characters. This token is used within the expressions mentioned above ("[]"and "[^]"). For example, [a-z] generates lowercase letters from "a" to "z"; [abcx-z] generates a, b, c, x, y or z (as an alternative, you can use the following token [a-cx-z]).
? Indicates that the previous element should be generated from 0 to 1 time. For example, ba? can only generate b or ba.
* Indicates that the previous element should be generated from 0 to 3 times. For example, ab*c can only generate ac, abc, abbc or abbbc.
+ Indicates that the previous element should be generated from 1 to 3 times. For example, ab+c can only generate abc, abbc or abbbc.
{min_num,max_num} Indicates that the previous element should be generated from min_num to max_num times. For example, a{3,5} can only generate aaa, aaaa and aaaaa.
| Generates any element from that specified. For example, John|David can only generate John or David; one|two|three can only generate one, two or three.
() Denotes a sub-expression. For instance, the ([0-9]{5})(\-[0-9]{4})? pattern contains two sub-expressions: [0-9]{5} and \-[0-9]{4}.
TestComplete allows specifying up to 9 sub-expressions inside one regular expression.
\ Indicates that the next character should be treated literally. For example, ab\+ will generate ab+; \\ is a backslash will generate the "\ is a backslash" string.

For information on using regular expressions for generating custom strings, see Custom String Generator Rules.

See Also

Custom String Generator Rules
About Custom String Generator
Regular Expressions Syntax

Highlight search results