Show TOC

Defining Data Lengths and PatternsLocate this document in the navigation structure

Use

You can define minimum and maximum lengths for schema elements with the data type String. You can also restrict the valid value set using regular expressions.

Procedure
  1. Select a schema element.

  2. On the Type tab, select String .

  3. Enter the attributes as shown in the table below.

    Before you enter an attribute you have to select the corresponding checkbox.

Attribute

Description

minLength

Minimum number of characters (including spaces, punctuation, and special characters)

maxLength

Maximum number of characters (including spaces, punctuation, and special characters)

Pattern

Regular expression to be used to validate the user input.

A regular expression defines a pattern that describes a set of character strings. At validation, the system checks whether the character string entered by the user matches this pattern.

Examples of Regular Expressions

Regular expressions are standard in the UNIX world and in programming languages such as Perl. For detailed information on the syntax of regular expressions, refer to the specialist literature that you can find on the Internet. The following examples are meant only to clarify regular expressions.

Expression

Description

^[1-6]$

A number between 1 and 6

^20([0][4-9]|[1][0-9])$

A year between 2004 and 2019

^(low|normal|high|very high)$

A simple value set ( low or normal or high or very high)

The system distinguishes between uppercase and lowercase.

Note that the value set cannot be localized.

^[1-9][0-9]{5}$

Number consisting of 6 figures that cannot begin with 0.

^https?://.*

The string must begin with http:// or https://

The characters ^ and $ at the beginning and end define that the character strings have to begin and end as specified. Validation does not accept entries that only contain the pattern as a partial string. If you omit the characters ^ and $ at the beginning and the end of the string, the system adds them.