Regular Expression Examples

A regular expression can be used in several places throughout STEP. The examples below are some of the common uses and are divided into the following areas:

Asset Importer

The following examples involve requirements for file name matching as used in Asset Importer.

For more information on asset importer, see the Asset Importer section of the Digital Assets documentation here.

Match a file name and save the part before the extension

Match the last folder in a path

Attribute Transformations

The following examples involve requirements for attribute values that should be modified when mounted in STEP’n’design.

For more information on attribute transformations, see the Attribute Transformations documentation here.

Transform attribute value based on the value

Consider the requirement that objects containing greater than 60% recycled material get an icon informing the customer that recycled materials were used. Using an Attribute Transformation (created in System Setup), it is possible to use a regular expression along with the transformation 'Replace substrings of the value using regular expressions' to modify the value of the attribute 'recycled percentage' (with ID RecycledPcent) only under the specified condition. Then, when mounted in STEP’n’design, the 'recycled' icon (with ID 232810) provided by the transformed value is displayed. For this example, two (2) regular expression transformations are used.

For additional information on transformations used in STEP Publisher to convert values to icons, see the Attribute Transformations in STEP Publisher topic in the STEP Publisher documentation here.

Import Transformations

The following examples involve requirements for attribute values that should be modified upon import.

For more information on import transformations, see the Modifying Data section of the Inbound Map Data Options section of the Data Exchange documentation here.

Format US Phone Numbers

Phone numbers in the United States are a total of ten (10) digits. The common formatting is three (3) digits within a set of parentheses, followed by three (3) digits, followed by a dash (-), and then a final four (4) digits. During import, the regular expression transformation can enforce the correct number of digits, as well as the formatting of this data.

Search

The following example shows that STEP Search allows for matching on a regular expression.

For more information on using a regular expression to search STEP values, see the Search: Advanced Options topic in the Getting Started / User Guide documentation here.

Find Text

Using a regular expression via the Advanced search option in workbench, allows a text string to be located in STEP regardless of the object type in which it appears.

Table Transformations

The following example involves a requirement for a table where text will be modified by applying a table transformation to the Table Definition when setting up a table in STEP Workbench.

For more information on transformations in tables, see the Table Transformations Section of the Tables documentation here.

Transform row / column text formatting

Once a table is defined in workbench, transformations can be added on the Preview tab. The Add Transformation link gives access to many transformations, including a formatting option that uses a regular expression to modify the text.

Validation Base Type

The following examples involve requirements for restricting the values that are allowed for an attribute.

For more information on using a regular expression as a validation base type, see the Validation Rules documentation here.

Format US Zip Code

Zip codes in the United States are five (5) digits, with an additional optional dash (-) and four (4) more digits. In STEP, the regular expression validation base type can enforce the correct formatting of this data, for example, 30144-5646.

Format US Social Security Numbers

Social Security Numbers (SSN) in the United States are a total of nine (9) digits. The common formatting is three (3) digits, followed by a dash (-), then two (2) digits, followed by another dash (-), and then a final three (3) digits. In STEP, the regular expression validation base type can be used to enforce the correct number of digits as well as formatting of this data, for example, 123456789 or 123-45-6789.