Export (0) Print
Expand All

The Regular Expression Generator

By using the regular expression generator, you can generate strings that match a defined pattern. You can use the regular expression generator with any data column that has a data type that accepts a string. These data types are char, varchar, varchar(max), text, nchar, nvarchar, nvarchar(max), ntext, and sysname, and user-defined types based on these types. You can also use the regular expression generator with common language runtime user-defined types.

Caution noteCaution

The regular expression generator cannot guarantee unique values. Therefore, it is not available for columns that must have unique values.

To use the regular expression data generator for a column, you must specify it in the Column Details window. After you have specified the regular expression generator, you must set the Expression property in the Properties window. The Expression property contains the pattern that you want the data to match. For more information, see Specifying Details of Data Generation for a Column.

The Regular Expression Operators

The Expression property supports the following regular expression operators:

Expression Description

.

Indicates any character.

\

Indicates that the character that follows should be interpreted literally, instead of as a special character. For example, \. indicates a literal '.'.

()

Groups the operators that are inside the parentheses.

{n}

Generates n instances of the previous item. For example, a{2} generates 'aa'.

{n,m}

Generates at least n instances but no more than m instances of the previous item. For example, a{2,4} generates 'aa', 'aaa', or 'aaaa'.

{n,}

Generates n or more instances of the previous item. For example, a{2,} generates 'aa', 'aaa', 'aaaa', 'aaaaa', and so forth.

*

Generates 0 or more instances of the previous item.

+

Generates 1 or more instances of the previous item.

?

Generates 0 or 1 instance of the previous item.

|

Generates an item on either side of the | character.

[aeiou]

Generates any character inside the brackets.

[a-z]

Generates any character in the specified range of characters.

[^aeiou]

Generates any character except those inside the brackets.

See Also

Show:
© 2014 Microsoft